Configuring Office365 smtp on ASP.NET 1.1 web applications

If you are still having that frustrating exception “The transport failed to connect to the server” while trying to use an Office365 smtp server settings with ASP.NET 1.1 websites or web applications, then here is the quick fix.

SmtpMail.SmtpServer = pod0000.outlook.com; //your smtp server
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusing”,”2″);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, “1″);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, myusername@email.com);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, mypassword);
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”, 25); //the confusing part is here
webMail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”,”true”);

We know that Office365 uses SSL and the port should be 587 (or 465 in some cases) but unfortunately for some reason 587 port does not work in ASP.NET 1.1 when using CDONTS. So just plain luck, tried port 25 and the emails went through. This scenario only applies to ASP.NET 1.1 whereas ASP.NET 2.0 or later work fine with 587 port.

Advertisement

About irtazaali
Project Manager, Application Developer, and Technical Consultant in a wide variety of business applications. Particularly interested in project and product development using C#.NET, ASP.NET, XAML, Visual Basic with datastores like XML, SQL Server, Oracle, and MySQL. Always interested in migration projects and ventures in product development. Have 12 years experience in commercial software product development. Quite knowledgeable in ROI and infrastructure development operations. Have previously worked as project manager-software products at US and UK based companies providing business intelligence software solutions. Hold MCSD.NET, OCP, and OCA certifications.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.