Hi everybody,
I am using ASP.Net combined with VB.Net to send an email. eMail functionality is working fine until my SMTP server is stopped.
If SMTP server is stopped the Message is not queued(Not going to the queue folder) and the "Failure Sending Email " exception occurs.
how to avoid this will anybody help me on this
below is the code which i used to send emails
Dim MailObjAsNew Mail.SmtpClient
Dim mailMessageAsNew Mail.MailMessage(pstrFrom, pstrTo)
Dim objUtilityAsNew Utility
If Trim(pstrCC) <>""Then
mailMessage.CC.Add(pstrCC)
EndIf
mailMessage.Bcc.Add(pstrBCC)
EndIf
mailMessage.IsBodyHtml =
TruemailMessage.Body = pstrContent
mailMessage.Subject = pstrSubject
MailObj.Host = objUtility.GetPathandURL("MailHost")
MailObj.DeliveryMethod = Mail.SmtpDeliveryMethod.Network
MailObj.Send(mailMessage)
You can find the complete mail functionality at
http://www.systemwebmail.com
Thanks
Since this person is using .NET 2.0, this site would be more appropriate:
http://www.systemnetmail.com/
actually we are working on C# so i am sending that code plz change it not vb.net for ur wish:
SmtpClient
smtpClient =newSmtpClient();MailMessage message =newMailMessage();MailAddress fromAddress =newMailAddress(fromEmail, from);body = body.Replace(
"\r\n","");if (Convert.ToBoolean(ConfigurationSettings.AppSettings["IS_SMTP_AUTHENTICATION_REQUIRED"])){
smtpClient.Credentials =
newNetworkCredential(ConfigurationSettings.AppSettings["ADMIN_USERNAME"].ToString(),ConfigurationSettings.AppSettings["ADMIN_PASSWORD"].ToString());}
smtpClient.Host =
ConfigurationSettings.AppSettings["SMTPSERVER_IP"].ToString();smtpClient.Port =
Convert.ToInt32(ConfigurationSettings.AppSettings["SMTPSERVER_PORT"].ToString());message.To.Add(to);
message.Subject = subject;
message.IsBodyHtml=
true;message.From = fromAddress;
message.Body = body;
smtpClient.Send(message);
return (1);
0 comments:
Post a Comment