473,322 Members | 1,566 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,322 software developers and data experts.

asp.net email - setting from name problem

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
8 4518
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
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
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
Correction.. I have also tried
objMail.From = "Bob Company" & "(bo*@bob.com)"

This does not work either.

Any ideas?
thx
Jul 21 '05 #5
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
Are you using MSFT Exchange? I am. Can you send pics to mm*******@yahoo.com?

thx
Jul 21 '05 #7
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
11
by: tshad | last post by:
I have a W2003 server running my website and I am trying to set up my pages to send email using System.Web.Mail. I have pages running on this machine using CDONTS that work fine. I am using...
3
by: Patrick | last post by:
I am dynamically creating TextArea and drop-down lists in ASP.NET using something like HtmlTextArea eachTextArea = new HtmlTextArea(); I tried to set the "name" of these TextAreas, etc. (e.g....
8
by: dave | last post by:
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...
2
by: Ken Varn | last post by:
I have a managed C++ method that I call from ASP.NET to set the time zone on the local box. I call SetTimeZoneInformation, which does not return an error, but the time zone remains unchanged. I...
5
by: ibid | last post by:
hi every one just wondering if anyone could help sorry if i seem abit dumb but im a newbie to it all ive got to asign a mail program on my auction site in the config.pl files (i think this is the...
1
by: creative1 | last post by:
When I test the application I get follwowing error: could not connect to smtp host: connection timeout error can someone please check if I have rigth settings? Where I am wrong here Is IP and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.