Link to home
Create AccountLog in
Avatar of craigbtg
craigbtg

asked on

SmtpMail Authentication

Hello, I have an ASP.Net 1.1 application that uses the SMTPMail class to send email through a third party SMTP mail server (GoDaddy).  Everything works correctly, but at times the authentication is very slow and it makes the site appear to hang until the mail message is sent.  Is there anything that can be done to speed up the authentication or make it so the site does not appear to hang, such as send the message  on a separate thread?

My code as it stands is as follows:
MailMessage msg = new MailMessage();
int cdoBasic = 1;
int cdoSendUsingPort = 2;
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", smtpUsername);
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", smtpPassword);
msg.To = sEmail;
msg.From = sFrom;
msg.Subject = sSubject;
msg.Body = sBody;
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(msg);
ASKER CERTIFIED SOLUTION
Avatar of LordWabbit
LordWabbit

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of craigbtg
craigbtg

ASKER

Good suggestion.  Do you happen to know of any pre-built services that already do this kind of polling?
Nope sorry, wrote one for a company a couple years ago, but they were really strict on intellectual property so when I left I shift-deleted any source code I had brought home to work on.