BlasterV
04-21-2008, 10:18 AM
I have tested this code on a different SMTP server and it worked fine, but it doesn't work with the smtp server listed on my discountASP.NET hosting account.
Anyone know if I have to do anything special?
domainnamefromdiscountasp is replaced by the domain name obviously :-D
[quote]
publicstaticStringserver='smtp.domainnamefromdisco untasp.com';
Amethod(){
MailMessagemsg=newMailMessage();
msg.From=newMailAddress(from);
msg.Subject=subject;
msg.Body=body;
msg.Priority=createPriority();
msg.IsBodyHtml=true;
SmtpClientsmtp=newSmtpClient(server);
IEnumeratore=recipents.GetEnumerator();
while(e.MoveNext())
{
msg.To.Add(e.Current.ToString());
try
{
smtp.Send(msg);
}
catch(Exceptionex)
{
Console.Error.WriteLine('Anerroroccuredtryingtosen dthismessage.'+'\n'+ex.Message);
}
msg.To.Clear();
}
}
</CODE>
This is method (and its class) is part of a C# library project we use in our web application, which is powered by C# back-end code and written in ASP.NET 3.5
Anyone know if I have to do anything special?
domainnamefromdiscountasp is replaced by the domain name obviously :-D
[quote]
publicstaticStringserver='smtp.domainnamefromdisco untasp.com';
Amethod(){
MailMessagemsg=newMailMessage();
msg.From=newMailAddress(from);
msg.Subject=subject;
msg.Body=body;
msg.Priority=createPriority();
msg.IsBodyHtml=true;
SmtpClientsmtp=newSmtpClient(server);
IEnumeratore=recipents.GetEnumerator();
while(e.MoveNext())
{
msg.To.Add(e.Current.ToString());
try
{
smtp.Send(msg);
}
catch(Exceptionex)
{
Console.Error.WriteLine('Anerroroccuredtryingtosen dthismessage.'+'\n'+ex.Message);
}
msg.To.Clear();
}
}
</CODE>
This is method (and its class) is part of a C# library project we use in our web application, which is powered by C# back-end code and written in ASP.NET 3.5