By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

asp.net email - setting from name problem

P: n/a
I am sending an email from an asp.net application. I
have set the from address a b@b.com but would like the
name of this user to show up as Big Bob.

How can i tell .net email object that when the user gets
the email i want the from person to be Big Bob. In
exchange the display name for this user is Bob Brown.
Currently users see Bob Brown as the from name field.

Is this possible?
thx
dave
Jul 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Dave,

You can try setting the From to "Big Bob (b@b.com)", and see if that works,
but apart from that, Exchange might still overwrite the display, 'cause
that's what it's got stored...

Thys Brits
MCSD/MCSD.Net

"dave" <dy@onlinelg.com> wrote in message
news:02****************************@phx.gbl...
I am sending an email from an asp.net application. I
have set the from address a b@b.com but would like the
name of this user to show up as Big Bob.

How can i tell .net email object that when the user gets
the email i want the from person to be Big Bob. In
exchange the display name for this user is Bob Brown.
Currently users see Bob Brown as the from name field.

Is this possible?
thx
dave

Jul 21 '05 #2

P: n/a
Hi Dave,

Firstly I want thank Thys for his good suggestion. I have tested his
suggestion on my side. It works.

using System;
using System.IO;
using System.Web.Mail;

namespace WebMail
{

class Class1
{

static void Main(string[] args)
{
try
{
MailMessage oMsg = new MailMessage();
oMsg.From = "Jacob Yang" + "(ji***@microsoft.com)";
oMsg.To = "ji***@microsoft.com";
oMsg.Subject = "Here is your report";

oMsg.BodyFormat = MailFormat.Html;

StreamReader s = new StreamReader(@"d:\largefile.txt");
oMsg.Body = s.ReadToEnd();
s.Close();

SmtpMail.SmtpServer = "smarthost";
SmtpMail.Send(oMsg);

oMsg = null;
s = null;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
}
}
}
}

Best regards,

Jacob Yang
Microsoft Online Partner Support
<MCSD>
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3

P: n/a
I can send an email ok. The problem is that I cannot change the
display name of the individual sending the email.

I have tried the following..

objMail.From = "bo*@bob.com" & "(Bob Company)"

Exchange still replaces the from name when the email is sent to Bob
Jones not "Bob Company".

I want the from name to be "Bob Company". Is this possible?

thx
dave
Jul 21 '05 #4

P: n/a
Correction.. I have also tried
objMail.From = "Bob Company" & "(bo*@bob.com)"

This does not work either.

Any ideas?
thx
Jul 21 '05 #5

P: n/a
Hi Dave,

I am sorry if there is any misunderstanding.

In my testing sample provided in my previous post, the display name in the
"From" is "Jacob Yang [ji***@microsoft.com]". That is the reason why I
stated that "I have tested his suggestion on my side. It works." The code I
am using is:

oMsg.From = "Jacob Yang" + "(ji***@microsoft.com)";

If I use the following code

oMsg.From = "Tim Huang(ji***@microsoft.com)";

the display name in the "From" is "Tim Huang [ji***@microsoft.com]"

If you want, I can capture some pictures and send them to you for your
reference.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #6

P: n/a
Are you using MSFT Exchange? I am. Can you send pics to mm*******@yahoo.com?

thx
Jul 21 '05 #7

P: n/a
Hi Dave,

I have sent the picture of my testing result to mm*******@yahoo.com. Please
check it when you have time.
--------------------------------------------------------
From: Jacob Yang
Sent: October 9, 2003 9:55
To: 'mm*******@yahoo.com'
Subject: asp.net email - setting from name problem

Hi Dave,

Thank you for using Microsoft MSDN managed newsgroup.

I noticed the following post in the microsoft.public.dotnet.general group.

asp.net email - setting from name problem

I am using MSFT Exchange and VS.NET 2003. I have attached the picture of my
testing result for your reference.

<< File: Result.JPG >>
In addition, my testing code is based on the following Knowledge Base
article:

HOWTO: Send E-mail Programmatically with System.Web.Mail and Visual C# .NET
http://support.microsoft.com/?id=310273

HOWTO: Send E-mail Programmatically with System.Web.Mail and Visual Basic
..NET
http://support.microsoft.com/?id=314201

I hope it helps.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------------------------------------------
Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #8

P: n/a
Hi Dave,

My email to mm*******@yahoo.com was rejected. I am not sure about the exact
reason. Would you please provide another email box?

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.