Let me start off saying I'm a novice and have been teaching myself as I go. My site was setup and running well, and I had a feedback form that sent through email, and an email notice when a client account was activated. Things were great...
This next part I outline because my issue may not be in the addition of SSL, so just to have all facts availiable - My mobo had a cap pop, and ASUS sent an RMA, but unfortunatly I wound up having to rebuild the machine. I do not remember putting an SMTP
client on the machine before, I believe I did everything in code only, but I could be mistaken. Also I switched from Norton to Trend... I restored my website and database from my backups and then found that AT&T now requires SSL so, I needed to update it.
I have opened port 465 in my firewall (and even shut it down) to test / troubleshoot, but I just can't get this to work. I suspect the problem is in my code, but... I need some help to be sure.
original Web.config
<system.net>
<
mailSettings>
<smtp
from="myemail">
<
network
host="smtp.att.yahoo.com"
port="25"
userName="myemail"
password="password for the email"
defaultCredentials="true"/>
</smtp>
Protected
Sub SendEmail()
'ToAddress is where I'm sending it.
Dim ToAddress
As
String = (strpupplaceholder)
'Create the MailMessage instance
Dim mm
As
New MailMessage()
'Assign the MailMessage's properties
'mm.Subject = Subject.Text
mm.From = New MailAddress("myemail",
"myname")
mm.To.Add(ToAddress)
mm.Subject =
"Your
http://myurl account has been activated"
mm.Body = "Your user account " & strpupplaceholder &
" has been activated by MYNAME ." & _
" You may begin using it now at http://myurl"
mm.IsBodyHtml =
False
'Create the SmtpClient object
Dim smtp
As
New SmtpClient
smtp.Host =
"smtp.att.yahoo.com"
smtp.UseDefaultCredentials =
"False"
smtp.Credentials = New System.Net.NetworkCredential("myemail",
"mypassword")
Try
smtp.Send(mm)
lblstatusmsg.Text =
"Account activation email sent"
Catch exc
As Exception
lblstatusmsg.Text =
"****Email Send Failure****" & exc.ToString()
Response.Write("Send failure: " + exc.ToString())
End
Try
End
Sub
New VB.NET Code
Protected
Sub SendEmail2()
Const ToAddress
As
String =
"myemail"
'Create the MailMessage instance
Dim mm
As
New MailMessage()
'Assign the MailMessage's properties
'mm.Subject = Subject.Text
mm.From = New MailAddress("myemail",
"myname")
mm.To.Add(ToAddress)
mm.Subject =
"Your myurl account has been activated"
mm.Body = "Your user account " & strpupplaceholder &
" has been activated by myname." & _
" You may begin using it now at http://myurl"
mm.IsBodyHtml =
False
Dim smtp
As
New System.Net.Mail.SmtpClient
Try
smtp.EnableSsl =
False
smtp.Send(mm)
Catch exc
As Exception
lblstatusmsg.Text =
"****Email Send Failure****" & exc.ToString()
Response.Write("Send failure: " + exc.ToString())
End
Try
End
Sub
Any ideas would be welcome. My head is tiring of being banged on the desk, and my eyes are tired of scanning books, websites, and my own code for ideas of what MIGHT be the problem (and not finding
the answer). Thank you in advance.
glued_to_con...
Member
4 Points
18 Posts
Mail issues with AT&T's SSL requirement
Apr 06, 2008 12:27 AM|LINK
Hello,
Let me start off saying I'm a novice and have been teaching myself as I go. My site was setup and running well, and I had a feedback form that sent through email, and an email notice when a client account was activated. Things were great...
This next part I outline because my issue may not be in the addition of SSL, so just to have all facts availiable - My mobo had a cap pop, and ASUS sent an RMA, but unfortunatly I wound up having to rebuild the machine. I do not remember putting an SMTP client on the machine before, I believe I did everything in code only, but I could be mistaken. Also I switched from Norton to Trend... I restored my website and database from my backups and then found that AT&T now requires SSL so, I needed to update it. I have opened port 465 in my firewall (and even shut it down) to test / troubleshoot, but I just can't get this to work. I suspect the problem is in my code, but... I need some help to be sure.
original Web.config
<system.net><
mailSettings> <smtp from="myemail"><
network host="smtp.att.yahoo.com" port="25" userName="myemail" password="password for the email" defaultCredentials="true"/> </smtp></
mailSettings></
system.net>new web.config
<system.net><
mailSettings> <smtp from="myemail"><
network host="smtp.att.yahoo.com" port="465" userName="myemail" password="mypassword" defaultCredentials="true"/> </smtp></
mailSettings></
system.net>Original VB.NET code
Protected Sub SendEmail() 'ToAddress is where I'm sending it. Dim ToAddress As String = (strpupplaceholder) 'Create the MailMessage instance Dim mm As New MailMessage() 'Assign the MailMessage's properties 'mm.Subject = Subject.Text mm.From = New MailAddress("myemail", "myname")mm.To.Add(ToAddress)
mm.Subject =
"Your http://myurl account has been activated" mm.Body = "Your user account " & strpupplaceholder & " has been activated by MYNAME ." & _ " You may begin using it now at http://myurl"mm.IsBodyHtml =
False 'Create the SmtpClient object Dim smtp As New SmtpClientsmtp.Host =
"smtp.att.yahoo.com"smtp.UseDefaultCredentials =
"False" smtp.Credentials = New System.Net.NetworkCredential("myemail", "mypassword") Trysmtp.Send(mm)
lblstatusmsg.Text =
"Account activation email sent" Catch exc As Exceptionlblstatusmsg.Text =
"****Email Send Failure****" & exc.ToString() Response.Write("Send failure: " + exc.ToString()) End Try End SubNew VB.NET Code
Protected Sub SendEmail2() Const ToAddress As String = "myemail" 'Create the MailMessage instance Dim mm As New MailMessage() 'Assign the MailMessage's properties 'mm.Subject = Subject.Text mm.From = New MailAddress("myemail", "myname")mm.To.Add(ToAddress)
mm.Subject =
"Your myurl account has been activated" mm.Body = "Your user account " & strpupplaceholder & " has been activated by myname." & _ " You may begin using it now at http://myurl"mm.IsBodyHtml =
False Dim smtp As New System.Net.Mail.SmtpClient Trysmtp.EnableSsl =
Falsesmtp.Send(mm)
Catch exc As Exceptionlblstatusmsg.Text =
"****Email Send Failure****" & exc.ToString() Response.Write("Send failure: " + exc.ToString()) End Try End SubAny ideas would be welcome. My head is tiring of being banged on the desk, and my eyes are tired of scanning books, websites, and my own code for ideas of what MIGHT be the problem (and not finding the answer). Thank you in advance.
jeff@zina.co...
All-Star
87677 Points
11637 Posts
Moderator
Re: Mail issues with AT&T's SSL requirement
Apr 07, 2008 12:38 PM|LINK
See www.systemnetmail.com.
Jeff
satalaj
Star
10505 Points
2031 Posts
MVP
Re: Mail issues with AT&T's SSL requirement
Apr 07, 2008 01:35 PM|LINK
I tried using System.Net, TcpipClient
string username = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes("yourYahooID"));
string password = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes("Password"));
TcpClient tcpclient = new TcpClient();
tcpclient.Connect("smtp.att.yahoo.com", 465);
System.Net.Security.SslStream sslstream = new SslStream(tcpclient.GetStream());
sslstream.AuthenticateAsClient("smtp.att.yahoo.com");
// sslstream.LocalCertificate.Import(
bool flag = sslstream.IsAuthenticated;
byte[] read = new byte[10024] ;
// sslstream.Write(System.Text.Encoding.ASCII.GetBytes("yourYahooID"), 0, System.Text.Encoding.ASCII.GetBytes("satalaj").Length);
System.IO.StreamWriter sw = new StreamWriter(sslstream);
sw.WriteLine("EHLO smtp.att.yahoo.com");
sw.WriteLine("AUTH LOGIN");
sw.WriteLine("satalaj");
//sw.Flush();
//
sw.WriteLine("password");
sw.Flush();
System.Threading.Thread.Sleep(2000);
sslstream.Read(read, 0, 1024);
System.Threading.Thread.Sleep(3000);
string str = System.Text.Encoding.ASCII.GetString(read);
// System.Threading.Thread.Sleep(2000);
sw.WriteLine("Mail From:<satalajNoSearchEngine@yahoo.co.in>");
//sw.Flush();
sw.WriteLine("RCPT TO:<satalajNoSearchEngine@yahoo.co.in>");
//sw.Flush();
sw.WriteLine("DATA ");
//sw.Flush();
sw.WriteLine("This is test message from yahoo");
sw.WriteLine(".");
//sw.WriteLine("quit");
sw.Flush();
sslstream.Read(read, 0, 10024);
System.Threading.Thread.Sleep(3000);
str = System.Text.Encoding.ASCII.GetString(read);
But No luck..........
satalaj