I am writing web services for an application in which there is a registration function and upon registration i have to send an email through the server. i have already done this kind of work for another website with Parallel Plesk server. using the same code i’m trying to send email but getting this exception. I searched Google and some related answers here but all in vain. Help?
“System.Net.Mail.SmtpException: Failure sending mail. —> System.Net.WebException: The remote name could not be resolved: ‘domainname.com’rn at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)rn at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)rn at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)rn at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)rn at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)rn at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)rn at System.Net.Mail.SmtpClient.GetConnection()rn at System.Net.Mail.SmtpClient.Send(MailMessage message)rn — End of inner exception stack trace —rn at System.Net.Mail.SmtpClient.Send(MailMessage message)rn at ActivityTracker.Controllers.ValuesController.parentRegistration(parent p) in c:UsersHarrisDocumentsVisual Studio 2012ProjectsActivityTrackerActivityTrackerControllersValuesController.cs:line 89”
2
Answers
Try to use GMail SMTP if it works with GMail SMTP then the problem exist with the domain you specified.
From the machine running your code:
This indicates that you are missing an internal DNS entry.
As your machine can talk to the IP but not using the DNS name – you can work around the issue by creating a Hostname entry for the domain name in question.
Here’s how to modify your Hostname file:
http://www.rackspace.com/knowledge_center/article/modify-your-hosts-file
Once this entry is in place, you should now be able to ping to domainname.com. When that works – rerun your code.
Some useful DNS reading:
http://www.techrepublic.com/article/understanding-how-dns-works-part-1/
http://social.dnsmadeeasy.com/blog/understanding-dns-forwarding/
NOTE: You’ve not confirmed if you can telnet to the port in question, so I am presuming this is ok – ruling out any firewall issues.