Disclaimer:Hey Guys, this post contains affiliate link to help our reader to buy best product\service for them. It helps us because we receive compensation for our time and expenses.
Recently, I had received a request from one of the customer to send some report from SQL to his management and it looks pretty simple to fulfill this request via send_db_mail.
But while using existing DB profile (profile which was being used by DBA monitoring) the email sent to customer or management consist server name in header section of the email (derived from existing DB profile), this could be avoided by creating new DB profile with required display name while account creation but we did not want to create a new DB profile rather using existing one and hiding server name from the header section.
Is it possible, Yes!
This is possible using below parameter while calling sp_send_dbmail
@from_address = 'custom display name <custom_address@your_domain.com>'
sp_send_dbmail [ [ @profile_name = ] 'profile_name' ] [ , [ @recipients = ] 'recipients [ ; ...n ]' ] [ , [ @copy_recipients = ] 'copy_recipient [ ; ...n ]' ] [ , [ @blind_copy_recipients = ] 'blind_copy_recipient [ ; ...n ]' ] [ , [ @from_address = ] 'custom display name <custom_address@your_domain.com>'
Try this out!
Treat your kid like a darling for the first five years. For the next five years, scold them. By the time they turn sixteen, treat them like a friend. Your grown up children are your best friends!!