Wednesday 18 August 2010

Sending an Email - Use Email ID which is not existed

In SharePoint, you can configure the outgoing Email by the user ID which is not a valid one or say not existed on SMTP server.
If you want to do same here is how you can go for it.

You can’t use SSIS “Send Mail task” for it as “Send Mail Task” use “Send As” not “Send”. “Send As” required a valid user ID (FROM in your Email). But if you send an email just by “Send” it just uses a SMTP server as connection and sends Email without verifying “FROM Email ID”
So to achieve the same you have to use SSIS Script task.

I found following link very useful for creating a SSIS Script task for Sending Email.

http://consultingblogs.emc.com/jamiethomson/archive/2006/07/03/SSIS_3A00_-Sending-SMTP-mail-from-the-Script-Task.aspx

Many Thanks to them; you made this very easy guy.
Just customize it for following to use an unidentified user.

NewEmailName = New MailAddress("ABCDEF@YourDomain.com", "ABCDEF@YourDomain.com")
myHtmlMessage = New MailMessage(NewEmailName.Address.ToString(),"ReceiverEmailID", "ETL Execution Completed Successfully", "ETL Execution Completed Successfully")

And you are good to go. Nice and easy.
Now you don’t required a specific user id for sending SSIS notifications. 