Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 How to specify Sender Name in Email Message

Author  Topic 

arid83
Starting Member

1 Post

Posted - 2011-03-02 : 06:13:11
using System.Net.Mail;
I have options to set properties like From Email Adress and On Behalf of Email Adress by setting

MailMessage mail = new MailMessage();
mail.From = new MailAddress(txtFEmail.Text, txtFName.Text);
mail.To.Add(new MailAddress(txtTEmail.Text, txtTName.Text));
mail.Sender = new MailAddress(txtBEmail.Text, txtBName.Text);

which works fine. I have tested it and found the cent% expected results as:

Test 1.

From: arid83@gmail.com on behalf of Naveed Ahmad (arid83@yahoo.com)
To: arid83@hotmail.com

Test 2.

From: Boss (boss@gmail.com) on behalf of Seceretry (secretry@gmail.com)
To: Naveed Ahmad (arid83@hotmail.com)

Test 3.

From: boss@gmail.com on behalf of Seceretry (secretry@gmail.com)
To: Naveed Ahmad (arid83@hotmail.com)


Now I want to do the same task using SQL Server DBMail ([sp_send_dbmail])
Which parameter should I have to set or any other alternate procedure.
I am using SQL Server 2008

Naveed Ahmad
   

- Advertisement -