Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
EXEC msdb.dbo.sp_send_dbmail @profile_name='testprofile',

@recipients='recipients_email@gmail.com',

@from_address='Test from address<test_from_email@gmail.com>',
@reply_to='',
@subject='Test message',
@body='This is the body of the test message.
Congrates Database Mail Received By you Successfully.'


In sql server 2008 using this code,mail send and from address is override,but from address not override with test_from_email@gmail.com ,from address remain same as profile email address,how to over ride this also,plese suggest me to do this .
Posted
Updated 30-Dec-13 12:01pm
v2

1 solution

From the MSDN:
SQL
[ @from_address= ] 'from_address'
Is the value of the 'from address' of the email message. This is an optional parameter used to override the settings in the mail profile. This parameter is of type varchar(MAX). SMTP security settings determine if these overrides are accepted. If no parameter is specified, the default is NULL.


So, your security settings can cause this setting to be ignored.
 
Share this answer
 
Comments
KuntalBose 31-Dec-13 0:41am    
can you please refer any document where i can find proper security settings or setup steps for that.

NOTE: I tried with "Test from address<test_from_email@gmail.com>" - this format,then only "Test from address" is appeared in from address but <test_from_email@gmail.com> this not appeared.
Christian Graus 31-Dec-13 0:57am    
http://technet.microsoft.com/en-us/library/ms190307.aspx is the MSDN article I found, you can look at links from there, or google.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900