PDA

View Full Version : trouble with Mail V2 from a web site


WynApse
09-24-2006, 02:07 AM
Thanks...

localhost took care of it.

Since I have this line showing in my code:

SmtpClient client = new SmtpClient("localhost");

I guess I don't understand your first comment about updating my smtp method.

Other than the fact that your example is in VB, unless I'm missing something obvious, we match :)

Thanks!

-Dave

wisemx
09-24-2006, 03:02 AM
...Great. http://community.discountasp.net/emoticons/wink.gif

The other isn't important, simply referencing a change inSMTP mail from .NET v1.1 to v2.

WynApse
09-24-2006, 05:05 AM
I have a site that's been running over a year now, and one of the pages is a form that is populated from a database that one of my instructors fills out and sends.

My code (C#, .NET 2.0) then scrapes the data and sends it to the instructor and me via SmtpClient. This worked Soooo smoothly when I first did it, I thought I was a genius :)

It's not working now, though, and I have a feeling it has not since the email v2 was setup on my site.

The body of the method, as it has been for a long while, and working:




string sRet;


sRet = OutputLabel.Value;


string sID = LocSupt.GetID();


string sTo = "dave@wynapse.us";


string sToAlso = LocSupt.GetEmailFromID(sID);


string sFrom = "dave@wynapse.com";


SmtpClient client = new SmtpClient("mail.wynapse.com");


MailAddress From = new MailAddress(sFrom);


MailAddress to = new MailAddress(sTo);


MailMessage message = new MailMessage(From, to);


message.Body = sRet;


message.Subject = LocSupt.GetReportHeader(sID);


client.Send(message);


MailAddress toAlso = new MailAddress(sToAlso);


MailMessage messageAlso = new MailMessage(From, toAlso);


messageAlso.Body = sRet;


messageAlso.Subject = LocSupt.GetReportHeader(sID);


client.Send(messageAlso);





The instantiation of the SmtpClient with "mail.wynapse.com" is probably no good any more. I've tried smtp.wynapse.com and smtp.west.cox.net (my ISP), but none of the three do anything more than throw an error.


Having the cox smtp in there worked fine from localhost, so I have no reason to believe it's the code, particularly since it's been running all along.


Any thoughts and/or assistance would be gladly accepted!


-Dave

wisemx
09-24-2006, 10:16 AM
You should update your smtp method if you're site is running v2 of the framework.
i.e. Dim SmtpClient As New System.Net.Mail.SmtpClient

For now, try changing your host from mail.wynapse.com to localhost