asp.net email - setting from name problem

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

I am sending an email from an asp.net application. I
have set the from address a (e-mail address removed) 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
 
Dave,

You can try setting the From to "Big Bob ([email protected])", 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
 
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" + "([email protected])";
oMsg.To = "(e-mail address removed)";
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.
 
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 = "(e-mail address removed)" & "(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
 
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 [[email protected]]". 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" + "([email protected])";

If I use the following code

oMsg.From = "Tim Huang([email protected])";

the display name in the "From" is "Tim Huang [[email protected]]"

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.
 
Hi Dave,

I have sent the picture of my testing result to (e-mail address removed). Please
check it when you have time.
--------------------------------------------------------
From: Jacob Yang
Sent: October 9, 2003 9:55
To: '(e-mail address removed)'
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.
 
Hi Dave,

My email to (e-mail address removed) 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.
 
Back
Top