asp.net to Office 365 smtp relay

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.
PianoMoverAsked:
Who is Participating?
 
PianoMoverAuthor Commented:
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
 
sshoe0Commented:
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
 
PianoMoverAuthor Commented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Éric MoreauSenior .Net ConsultantCommented:
0
 
PianoMoverAuthor Commented:
Emoreau
I am looking for an asp.net code solution, not setting up a smtp server relay.
0
 
PhilonatorownerCommented:
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
 
Amandeep Singh BhullarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.