I want to sending email through smtp.office365.com in VB.NET
It work!! when i use "FROM" address same as user authentication
BUT how to send emails using other email address as the FROM address in domain
I try "Mailbox Delegation" set other email address for behalf
BUT it don't work. Please suggest where I'm going wrong.
I am using the following to
Dim myMessage As New System.Net.Mail.MailMessage
Dim myClient As New System.Net.Mail.SmtpClient()
Dim strUserName As String = "john@domain.com"
Dim strPassword As String = "p@ssw0rd"
myClient.Port = 587
myClient.Host = "smtp.office356.com"
myClient.Credentials = New System.Net.NetworkCredential(strUserName, strPassword)
myClient.EnableSsl = True
myMessage.From = New System.Net.Mail.MailAddress("marry@domain.com")
myMessage.To.Add(strTo)
myMessage.Subject = "Send E-mail using Office365"
myMessage.Body = "Test Send Email"
myClient.Send(myMessage)