Hi,
I am making a form in asp.net 3.5 which will send an email to the recipient
Initially I was using system.web.mail
as it is obvious whenever you send an email to some recipient a display name appears instead
of theemail id of the sender
consider:
[email protected]
display_name="my name"
in my case instead of the display_name "mail" the initial portion of the sender's email id is coming
but it is desired that "my name" should appear in the recipient's inbox.
due to this I had to switch to system.net.mail
but there also same problem occurs.
I have tried googling on this issue too, but still no help.
Any help shall be appreciated !
Thanks
Pankaj
Loading
Kirtan PatelPosted Oct 23, 2009, 11:50 AM
using System.Text;
Pankaj SinghPosted Oct 23, 2009, 11:26 AM
This line not working::
Kirtan PatelPosted Oct 23, 2009, 10:57 AM
Pankaj SinghPosted Oct 23, 2009, 10:22 AM
In your code there is no code to display name, when we sending mail.
Kirtan PatelPosted Oct 23, 2009, 8:52 AM
check "Do you like this answer" if it helped you :)
Pankaj SinghPosted Oct 23, 2009, 8:02 AM
My code:
- try
- {
- //Creating new mail message
- System.Web.Mail.MailMessage MyMail = new System.Web.Mail.MailMessage();
-
- //Display Name can be sent using following format
- //\<
>\ " - MyMail.From = @"\Webtips Emailer\
" ; -
- //To Address
- MyMail.To = "[email protected]";
-
- // BCC Address
- MyMail.Bcc = "[email protected]";
-
- //Mail Subject
- MyMail.Subject = "Subject Of the mail";
-
- //Body of the mail
- MyMail.Body = "test mail message";
- MyMail.BodyFormat = System.Web.Mail.MailFormat.Html;
-
- //SMTP Server name or IP from which mail to be sent
- System.Web.Mail.SmtpMail.SmtpServer = "smtp.someserver.com";
-
- //Sending Mail
- System.Web.Mail.SmtpMail.Send(MyMail);
- }
- catch
- {
- }
PankajVenkatesh EllurPosted Oct 23, 2009, 7:53 AM