473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MailMessage.From - how to set the address?

Hi,

MailMessage.From allows me to set the email address that the message comes
from but not the "covering address" (sorry, no idea what the correct
terminology might be).

The email message should have the To: field appear as "Joe Bloggs" rather
than the plain e-mail address.

Any ideas?

Cheers,
Richard,.
Nov 15 '05 #1
2 11768
"Richard Bogle" <ri***********@DIEedinburgh-SPAMsoftware-DIEconsultants.co.uk> wrote in message news:<vi************@corp.supernews.com>...
Hi,

MailMessage.From allows me to set the email address that the message comes
from but not the "covering address" (sorry, no idea what the correct
terminology might be).

The email message should have the To: field appear as "Joe Bloggs" rather
than the plain e-mail address.

Richard -

I assume you mean the descriptive text that is seen next to the
real e-mail address, such as:

From: Joe Bloggs <joe_bloggs@someplace>

To do this you must create a custom From header instead of just
using the standard From property of the MailMessage object:

Mailmessage mm = new MailMessage();
mm.To = anotherguy@someotherplace
mm.Headers.Add("From", "Joe Bloggs <joe_bloggs@someplace>");
mm.Subject = "Test message";
mm.Body = "This is a test";
SmtpMail.Send(mm);

Hope this helps solve your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #2
Thanks. Both your and Tu-Thach's suggestion work.

Cheers,
Richard,.

"Rich Blum" <ri*******@juno.com> wrote in message
news:cc**************************@posting.google.c om...
"Richard Bogle"

<ri***********@DIEedinburgh-SPAMsoftware-DIEconsultants.co.uk> wrote in
message news:<vi************@corp.supernews.com>...
Hi,

MailMessage.From allows me to set the email address that the message comes from but not the "covering address" (sorry, no idea what the correct
terminology might be).

The email message should have the To: field appear as "Joe Bloggs" rather than the plain e-mail address.

Richard -

I assume you mean the descriptive text that is seen next to the
real e-mail address, such as:

From: Joe Bloggs <joe_bloggs@someplace>

To do this you must create a custom From header instead of just
using the standard From property of the MailMessage object:

Mailmessage mm = new MailMessage();
mm.To = anotherguy@someotherplace
mm.Headers.Add("From", "Joe Bloggs <joe_bloggs@someplace>");
mm.Subject = "Test message";
mm.Body = "This is a test";
SmtpMail.Send(mm);

Hope this helps solve your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Chang | last post by:
I am trying to do some analysis on customer's locality, so I'd like to extract numeric part from address. Here is how the table looks like Table Member first_name last_name address1 ...
6
by: Jason | last post by:
Sorry for the post here but could not find an Exchange newgroup. I developed an application a year or 2 ago that sends SMTP email. The application allows the user to customize the text from...
1
by: James | last post by:
Is there a way of getting the default email address for the logged in user? I am creating a MailMessage and need a valid from address in order to send an email in my app with SmtpMail.Send.
7
by: Jay | last post by:
Hi, I am using the MailMessage object to send mails. One issue that I am currently facing is that the 'From' address that I provide is not getting resolved. I was testing the code with the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.