i written a simple code
SmtpClient smtp = new SmtpClient(“localhost”);
smtp.Send(“from@testserver.com”, “to@testrserver.com”, “Test mail subject”, “Test mail body”);
but got exception “Mailbox unavailable. The server response was: 5.7.1 Unable to relay to@servername.com.”. Problem is not in the code problem is in the configuration of localhost. It considers itself being used as a mail relay and by default it does not allow anyone to do that. It is easy to solve.
1. Go to “Default SMTP Virtual Server” in IIS and then go to properties
2. Select tab “Access”
3. Add ip of localhost “127.0.0.1”
Asalamualikum. This post is usefull for me. Thanx for posting….
hi ashraf how is soccer going ?
Problem has solved but the mail is not reaching to email address provided in to box.
please provide any solution
Thanz….no errors
but the mail is not reaching to email address provided in to box.
mail is not reaching to email address provided in to box.
I get resolved my email sending error by this tutorial. Thanks guys for such an informative post