'SSIS script task failing to send email SMTPexception:System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed
I am using a script task in SSIS to send emails. Code snapshot below:
It is failing with the below error:
Please note, it was working fine a couple of weeks back. What I have tried so far:
- Tried changing SMTP details to gmail. It works fine with gmail after allowing the "less secure apps" setting
- Added "SmtpServer.UseDefaultCredentials = false;" in code - it did not help
- Tried sending email through powershell command. It works from there. Powershell command below:
Send-MailMessage -To “<emailId>” -From “<emailId>” -Subject “Your message subject” -Body “Some important plain text!” -Credential (Get-Credential) -SmtpServer “smtp.office365.com” -Port 587 -UseSsl
Not sure why the email is not working from the SSIS script task. Please help with any pointers for further investigation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


