cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ASP .NET email - Error Sending Email SMTP

We are recently transferred from other hosting to godaddy. We are having issues with sending email. Our code is written classic asp.net

 

Here is code to Send mail

 

public int Send_Mail(string Id, string Sub, string Msg, string filename)

{

MailMessage mail = new MailMessage();

SmtpClient smtp = new SmtpClient();

smtp.Host = ConfigurationManager.AppSettings["smtpserver"].ToString();

 

//smtp.Host = dmdAppSettings.smtpserver;

smtp.Port = 25;

 

 

smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

 

mail.From = new MailAddress(ConfigurationManager.AppSettings["smtpemail"].ToString());

mail.Subject = Sub;

mail.IsBodyHtml = true;

mail.Body = Msg;

 

mail.CC.Add(Id);

if (filename != "")

{

try

{

var attachment = new Attachment(filename);

mail.Attachments.Add(attachment);

}

catch (Exception ex)

{

 

 

}

}

// SEND EMAIL

smtp.Send(mail);

return 1;

}

 

 

and the setttings in the web.config.

 

<appSettings>

<add key="smtpserver" value="relay-hosting.secureserver.net"/>

<add key="smtpuser" value=""/>

<add key="smtppwd" value=""/>

<add key="smtpemail" value="admin@bmdnotices.com"/>

</appSettings>

 

We are not sure what we are doing wrong here. It was working in last hosting provider. Please help us.

 

 

Kind Regards,

BMD notices tech support

0 REPLIES 0