Nalaka526
Nalaka526

Reputation: 11464

Error when sending emails from .net web site

I need to send e mail from a asp.net web site. I use this code to send mail

Dim Mail As New MailMessage(fromEmail, toEmail, subject, message)
Mail.IsBodyHtml = True
Mail.Priority = MailPriority.Normal

Dim smtpclint As New SmtpClient(mailServerIp)
smtpclint.UseDefaultCredentials = True
smtpclint.Port = mailPort
smtpclint.Send(Mail)

The mail server is not in same network with the web server (it's in different location).

Sometimes this works fine (sends the mail without any error), but sometimes it does not work and gives an error saying,

Mailbox unavailable. The server response was: [email protected] must check for new mail first

Any idea how to fix this issue

Upvotes: 0

Views: 411

Answers (1)

David
David

Reputation: 73564

This is not a problem with your code. This is the mail server at the other end returning the message. You need to check with the people that control that mail server.

The only thing you can do from your code is to put this in a Try...Catch block, as this is an error that you can anticipate and handle gracefully.

Upvotes: 1

Related Questions