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'\\r\\n at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)\\r\\n at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)\\r\\n at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)\\r\\n at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)\\r\\n at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)\\r\\n at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)\\r\\n at System.Net.Mail.SmtpClient.GetConnection()\\r\\n at System.Net.Mail.SmtpClient.Send(MailMessage message)\\r\\n --- End of inner exception stack trace ---\\r\\n at System.Net.Mail.SmtpClient.Send(MailMes sage message)\\r\\n at ActivityTracker.Controllers.ValuesController.parentRegistration(parent p) in c:\\Users\\Harris\\Documents\\Visual Studio 2012\\Projects\\ActivityTracker\\ActivityTracker\\Controllers\\ValuesController.cs:line 89"
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.
尝试使用 GMail SMTP,如果它与 GMail SMTP 一起工作,那么您指定的域存在问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.