Developer forum

Forum » Development » SMTP error in custom module

SMTP error in custom module


Reply

Here is the code i use to send mail:

System.Net.Mail.

mail.IsBodyHtml =

System.Net.Mail.

smtp.Send(mail);

MailMessage mail = new System.Net.Mail.MailMessage(this.Properties.get_Value("mySender"), this.Properties.get_Value("myRecipient"), this.Properties.get_Value("mySubject"), mytext);true;SmtpClient smtp = new System.Net.Mail.SmtpClient(Dynamicweb.Modules.Common.Constants.SMTP); and here is the error i get when sending: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'localhost;smtp.dynamicsystems.dk' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at CustomModules.CustomModules.CustomDownloadbox.CustomDownloadbox.GetContent() at Dynamicweb.Frontend.Content.getModule(DataRow& Par

 

the Website is located at climateconsult.net.dynamicweb.dk


Replies

 
Nicolai Høeg Pedersen
Reply
kgo@up-site.dk wrote:

Here is the code i use to send mail:

System.Net.Mail.

mail.IsBodyHtml =

System.Net.Mail.

smtp.Send(mail);

MailMessage mail = new System.Net.Mail.MailMessage(this.Properties.get_Value("mySender"), this.Properties.get_Value("myRecipient"), this.Properties.get_Value("mySubject"), mytext);true;SmtpClient smtp = new System.Net.Mail.SmtpClient(Dynamicweb.Modules.Common.Constants.SMTP); and here is the error i get when sending: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'localhost;smtp.dynamicsystems.dk' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at CustomModules.CustomModules.CustomDownloadbox.CustomDownloadbox.GetContent() at Dynamicweb.Frontend.Content.getModule(DataRow& Par

 

the Website is located at climateconsult.net.dynamicweb.dk


 

You should use Base.DefaultSmtpServer() and not Dynamicweb.Modules.Common.Constants.SMTP.

 

You must be logged in to post in the forum