I have a package using the Send Email Task.
On the SMTP connection, I have the smtp server specified and the Use Windows Authentication checked and the Enable Secure Sockets Layer unchecked.
Now, I want to send an email that has some data from a table embedded in the body.
So, I have added a Script Task with the following code:
Dim myHtmlMessage As MailMessage
Dim mySmtpClient As SmtpClient
myHtmlMessage = New MailMessage("FromEmailaddress", "ToEmailAddress", "Test", Msg)
mySmtpClient = New SmtpClient("smtp.server")
mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials
myHtmlMessage.IsBodyHtml = True
Catch ex As Exception
Dts.TaskResult = Dts.Results.Failure
The FromEmail and ToEmail are my own network email and the SMTPClient is my companies SMTP server, which is the same entry I had in the SMTP Connection Manager for the Send Email Task.
When I run the code, I don't get any errors but I never receive the email.
I'm trying to figure out why the Send Email Task works but this code does not.
Any help would be great.