Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

Change display name at runtime during mail sending using database mail in SQL Server

Aug 26 2011 7:08AM by Paresh Prajapati   

During working for script to send mail alerts, i just learned as we can change display name for the mail at runtime. It will normally use profile name or display name which configured in database mail profile for mail. Below query will use display name "MailProfile1".

EXEC MSDB.DBO.SP_SEND_DBMAIL  
   @from_address = 'abc@mail.com'
 , @recipients = 'xyz@mail.com'
 , @subject = 'This is test mail'  
 , @body = 'This is test mail'   
 , @profile_name = 'MailProfile1'  
 , @body_format = 'HTML' 
 GO

But we can change display name other than configured with small change while firing it as below,

EXEC MSDB.DBO.SP_SEND_DBMAIL  
   --@from_address = 'abc@mail.com'
   @from_address = 'test mail <abc@mail.com>' 
   -- Whatever you can write in place of 'test mail'
 , @recipients = 'xyz@mail.com'
 , @subject = 'This is test mail'  
 , @body = 'This is test mail'   
 , @profile_name = 'MailProfile1'  
 , @body_format = 'HTML' 
 GO
Read More..   [0 clicks]

Published under: SQL Server Tips ·  ·  ·  · 


Paresh Prajapati
6 · 22% · 7044
11
 
6
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

1  Comments  

  • The reason this is possible is because database mail uses SMTP relay to send out the E-mails. SMTP would allow you to tweak almost anything.

    commented on Aug 27 2011 9:02AM
    Nakul Vachhrajani
    4 · 33% · 10564

Your Comment


Sign Up or Login to post a comment.

"Change display name at runtime during mail sending using database mail in SQL Server" rated 5 out of 5 by 11 readers
Change display name at runtime during mail sending using database mail in SQL Server , 5.0 out of 5 based on 11 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]