postal
postal copied to clipboard
Using Postal on Azure with Sendgrid
Hi, i'm trying to use Postal on a web app hosted in Azure. But get this error: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
This is the code i'm using:
dynamic email = new Email("Test"); email.To = "[email protected]"; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("azure_d3e************************[email protected]", "7N**********5C"); SmtpClient smtpClient = new SmtpClient("smtp.sendgrid.net", Convert.ToInt32(587)); smtpClient.Credentials = credentials; email.Send();
My Test view:
To: [email protected] From: [email protected] Subject: Important Message
Hello, This is a tests!!
My web.config smtp settings:
I use Postal with SendGrid in Azure (Web Apps). The only thing I changed was in the web.config.
<mailSettings>
<smtp from="[email protected]" deliveryMethod="Network">
<specifiedPickupDirectory pickupDirectoryLocation="c:\email" />
<network host="smtp.sendgrid.net" port="587" userName="{username}" password="{password}" />
</smtp>
</mailSettings>
And then I just dynamic e = new Email("view"); e.Send();
However, in your code, you have an SMTP client you instantiated, but you didn't do anything with it. Not sure if it was a copy & paste error. But, if there's nothing in your config, that would never work.