I am trying to send mail in SQL Server. I have a SSIS package the sends the mail using a script task.
When I run that package in Visual Studio, the mail sends. When I let SQL Server run the package, the package "succeeds" but no mail sends. When I set it up with a Send Mail Task & SMTP Connection Manager, the mail sends in SQL Server.
I would think that because the using an SMTP connection manager allowed the mail to send, that mimicking those credentials in the code would also make the email send. The connection manager had the settings: SMTP Server: MAIL.XXXXX.COM Use Windows Authentication: no Enable SSL: no
When I create the SMTP client in the script, I use
mySmtpClient = new SmtpClient("MAIL.XXXXX.COM");
mySmtpClient.EnableSsl = false;
mySmtpClient.Send(htmlMessage);
Why doesn't the email send through code, if it does when using a connection manager?