Does anyone know why my office365 email account works from inside our domain but does not work from our DMZ server?
Email sent from DMZ server to recipients with exchange account works fine.
However, users are not receiving emails sent to our office365 email account.
I have tried using my domain account but it does not work. I also tried using the DMZ server account but that does not send email either.
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click
'Address of email sender
Dim ccEmail As String = txtemail.Text
'Create the msg object to be sent
Dim msg As New MailMessage()
'Add your email address to the recipients
'Configure the address we are sending the mail from
Dim fromEmail As New MailAddress(ccEmail)
msg.From = fromEmail
'Append their name in the beginning of the subject
msg.Subject = "Testing Office365 email account"
'To embed image in email
msg.Body = "If you receive this email, then office365 email account is working from DMZ server"
' msg.Attachments.Add(New Attachment(New MemoryStream(bytes), lblEmpName.Text & DateTime.Now.Ticks & ".pdf"))
msg.IsBodyHtml = True
'Configure an SmtpClient to send the mail.
Dim client As New SmtpClient("xxx.xxx.x.xxx") 'Exhange IP Address
client.Host = "smtp.office365.com"
client.Credentials = New System.Net.NetworkCredential("dmzuser", "mydmzpassword")
'client.DeliveryMethod = SmtpDeliveryMethod.Network
client.EnableSsl = True
client.Port = 25
'Send the msg
lblMsg.Text = "Success!"
Thanks in advance