Solved

asp.net to Office 365 smtp relay

Posted on 2011-09-25
8
2,103 Views
Last Modified: 2013-11-27
I currently have an asp.net website that sends emails to my SBS2008 server.  I am in the midst of moving my email to office 365.  I need to edit the asp.net code to work with office 365 and make sure that office 365 is able to receive emails from my separately hosted website.  

Here is the code I have converted so far that does NOT work with Office 365:
           Dim client As New SmtpClient
           client.Host = "pod???.outlook.com"
           client.Port = 587
           client.EnableSsl = True
           client.Credentials = New NetworkCredential("email address", "password")
           client.Send(Message)

This code currently gets the following error:
5 The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated

The code above works with my SBS2008 server, but I am missing an important detail to make this work with Office 365.  I believe it has something to do with TLS, but I don't see anyother options to modify.

I should also mention that I would like the emails to show they come from the person submitting them from the website, to make it easy to reply to.  Making this a smtp relay question and that might mean I require additional configuration changes to my office 365 setup to allow it to accept these types of emails so it doesn't get caught as spam.
0
Comment
Question by:PianoMover
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Expert Comment

by:sshoe0
ID: 36598562
You can use http://www.checktls.com/TestReceiver?FULL to check that the receiver will accept various emails.

You can use that same site's Watch Connect feature to watch your client (try to) connect to the server.  http://www.checktls.com/watchconnect.html
0
 

Author Comment

by:PianoMover
ID: 36936054
I've got the code to work if the email address is set to the account I am sending too in office 365.  The problem is the webform on the website is on behalf of the user, using the website.  The from email address needs to be from the input form.  I know this is possible on other websites like wordpress.  The question is how is it done.

Any other suggestions out there???
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 36936102
0
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

 

Author Comment

by:PianoMover
ID: 36936345
Emoreau
I am looking for an asp.net code solution, not setting up a smtp server relay.
0
 
LVL 7

Expert Comment

by:Philonator
ID: 37801667
Emoreau is kind of right.  You can't send email from the website because you are getting rejected by the 365 for not having enough (tls) ecryption.  The two easy choices are instead of trying to send it directly to Microsoft:

1.  Build your own relay server with the correct encryption and authentication

2.  The easier route, contact your host or ISP and chances are they already have an address and server already set up.  Most are set up as smtp.ISP.com or something like that.
0
 

Accepted Solution

by:
PianoMover earned 0 total points
ID: 37807681
In the end I found I could send emails to myself from myself and with enablessl, it seems to work.  For replying to my customers I had to set the replytoo parameter.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37932312
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Adoption of Microsoft’s Enterprise Mobility and Security solution and Office 365 will re-order the File Sync and Share market Microsoft has stated that its Enterprise Mobility + Security (EMS) is the fastest growing product in the history of the …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question