I can use outlook2003 to send email,but I cann't use this code below to send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.。-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
=============== 16 4668
Is your logon name "uid" and your password "pwd"? If not, change these values
to your logon id and password. That should get things running.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Chef" wrote:
I can use outlook2003 to send email,but I cann't use this code below to send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.。-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
but I cann't use this code below to send email.
What happens when you try...?
I used my real user name and password to replace "uid" and "pwd" in the code.
"Cowboy (Gregory A. Beamer) - MVP" wrote:
Is your logon name "uid" and your password "pwd"? If not, change these values
to your logon id and password. That should get things running.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Chef" wrote:
I can use outlook2003 to send email,but I cann't use this code below to send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.。-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
It happend below!
"Send Email Failed.System.Net.Mail.SmtpException: The operation has timed
out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at
MainPage.Button1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePages\MainPage.aspx.cs:line 94 "
"Mark Rae" wrote:
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
but I cann't use this code below to send email.
What happens when you try...?
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:FF**********************************@microsof t.com...
"Send Email Failed.System.Net.Mail.SmtpException: The operation has timed
out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at
MainPage.Button1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePages\MainPage.aspx.cs:line 94 "
Indulge me - what does line 94 contain...? I'm assuming it's:
client.Send(message);
client.Send(message); //line 94
"Mark Rae" wrote:
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:FF**********************************@microsof t.com...
"Send Email Failed.System.Net.Mail.SmtpException: The operation has timed
out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at
MainPage.Button1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePages\MainPage.aspx.cs:line 94 "
Indulge me - what does line 94 contain...? I'm assuming it's:
client.Send(message);
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0) http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below to
send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
Thank you very much.
Your code is really helpfull. It worked with port 587, not 465 on my pc. One
more thing, could you tell me what the problem is with my code?
"sloan" wrote:
>
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0) http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below to
send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
If I use gmail as smtp server, what the different between port 587 and port
465 is?
I just check gmail online help, it recommend that we use port 465. Why? Waht
is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
>
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0) http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below to
send
email.
Please help me to test this code and instruct me how to solve this problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
If I use gmail as smtp server, what the different between port 587 and
port
465 is?
I just check gmail online help, it recommend that we use port 465. Why?
Waht
is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0)
http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
>
>
>
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I
can
surf internet, not send email with code.
>
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
>
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
>
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
>
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
Not really, unless I was sitting next to you (or at least on your network).
I've found smtp email sending is experimentation sometimes.
Thus why I built the "smarter email configuration" model.
Because I'd get different behavior
at work
at home
using dialup somewhere.
Sometimes its an art, not a science.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
Thank you very much.
Your code is really helpfull. It worked with port 587, not 465 on my pc.
One
more thing, could you tell me what the problem is with my code?
"sloan" wrote:
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0)
http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
>
>
>
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I
can
surf internet, not send email with code.
>
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
>
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
>
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
>
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
Thank you very much and have a nice day!
"sloan" wrote:
>
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
If I use gmail as smtp server, what the different between port 587 and
port
465 is?
I just check gmail online help, it recommend that we use port 465. Why?
Waht
is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
>
I have downloadable examples here:
>
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0)
http://sholliday.spaces.live.com/blog/
>
>
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I
can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
>
>
>
re:
!Experimentation showed that for 1.1 .. one of those ports worked.
!and for 2.0, only the other one worked.
Check for code differences.
The port used depends on your ISP's ( Gmail, in this case ) server's settings,
and not on any code you write. The port is determined by your ISP, not by your code.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"sloan" <sl***@ipass.netwrote in message news:uT**************@TK2MSFTNGP03.phx.gbl...
>
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
>If I use gmail as smtp server, what the different between port 587 and
port
>465 is?
I just check gmail online help, it recommend that we use port 465. Why?
Waht
>is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
>
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0)
http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem directly,but I
can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
Juan
I agree with you.. except for the gmail smtp server.
1.1 framework likes port 465
2.0 Framework, my tests show that gmail likes port 587
I can't explain only, I can only say that was how it played out.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
re:
!Experimentation showed that for 1.1 .. one of those ports worked.
!and for 2.0, only the other one worked.
Check for code differences.
The port used depends on your ISP's ( Gmail, in this case ) server's
settings,
and not on any code you write. The port is determined by your ISP, not by
your code.
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"sloan" <sl***@ipass.netwrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
If I use gmail as smtp server, what the different between port 587 and
port
465 is?
I just check gmail online help, it recommend that we use port 465. Why?
Waht
is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0)
http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code
below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
>
>
>
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem
directly,but I
can
surf internet, not send email with code.
>
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new
System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't
work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
>
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
>
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
>
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
587 is the assigned SMTP port for applications which support TLS.
465 is the assigned SMTP port for applications which support SSL.
The Transport Layer Security (TLS) 1.0 protocol is disabled in the .NET Framework 1.1.
By default, only the Secure Sockets Layer (SSL) 3.0 protocol is enabled in .Net 1.1.
That means that, if you use the .Net Framework 1.1 to send mail, you *must* use port 465.
By default, TLS 1.0 and SSL 3.0 are *both* enabled in the Microsoft .NET Framework 2.0.
That means that, if you use the .Net Framework 2.0 to send mail,
you can use port 465 *or* you can use port 587, depending on the security protocol you enable.
The port you need to use *really* depends on which security layer your application uses.
re:
I can't explain only, I can only say that was how it played out.
The above is the technical explanation. :-)
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"sloan" <sl***@ipass.netwrote in message news:%2****************@TK2MSFTNGP03.phx.gbl...
Juan
I agree with you.. except for the gmail smtp server.
1.1 framework likes port 465
2.0 Framework, my tests show that gmail likes port 587
I can't explain only, I can only say that was how it played out.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>re: !Experimentation showed that for 1.1 .. one of those ports worked. !and for 2.0, only the other one worked.
Check for code differences.
The port used depends on your ISP's ( Gmail, in this case ) server's
settings,
>and not on any code you write. The port is determined by your ISP, not by
your code.
>>
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ =================================== "sloan" <sl***@ipass.netwrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
>
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com... If I use gmail as smtp server, what the different between port 587 and
port 465 is?
I just check gmail online help, it recommend that we use port 465. Why?
Waht is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and
2.0) http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code
below
to
send
email.
Please help me to test this code and instruct me how to solve this
problem
in detail.
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects two
computers.?-- I also tried to connect computer to modem
directly,but I
can
surf internet, not send email with code.
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new
System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't
work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." + ex.ToString()); ;
}
===============
Aha,
Thanks for the explanation.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
587 is the assigned SMTP port for applications which support TLS.
465 is the assigned SMTP port for applications which support SSL.
The Transport Layer Security (TLS) 1.0 protocol is disabled in the .NET
Framework 1.1.
By default, only the Secure Sockets Layer (SSL) 3.0 protocol is enabled in
..Net 1.1.
>
That means that, if you use the .Net Framework 1.1 to send mail, you
*must* use port 465.
>
By default, TLS 1.0 and SSL 3.0 are *both* enabled in the Microsoft .NET
Framework 2.0.
>
That means that, if you use the .Net Framework 2.0 to send mail,
you can use port 465 *or* you can use port 587, depending on the security
protocol you enable.
>
The port you need to use *really* depends on which security layer your
application uses.
>
re:
I can't explain only, I can only say that was how it played out.
The above is the technical explanation. :-)
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Juan
I agree with you.. except for the gmail smtp server.
1.1 framework likes port 465
2.0 Framework, my tests show that gmail likes port 587
I can't explain only, I can only say that was how it played out.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
re:
!Experimentation showed that for 1.1 .. one of those ports worked.
!and for 2.0, only the other one worked.
Check for code differences.
The port used depends on your ISP's ( Gmail, in this case ) server's
settings,
and not on any code you write. The port is determined by your ISP, not
by
your code.
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"sloan" <sl***@ipass.netwrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
I have no idea.
Experimentation showed that for 1.1 .. one of those ports worked.
and for 2.0, only the other one worked.
????
Huh? I'm with you, but I have no idea.
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
If I use gmail as smtp server, what the different between port 587
and
port
465 is?
I just check gmail online help, it recommend that we use port 465.
Why?
Waht
is the reason you used port 587?
Thanks in advance!
"sloan" wrote:
I have downloadable examples here:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1
and
2.0) http://sholliday.spaces.live.com/blog/
"Chef" <Ch**@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
I can use outlook2003 to send email,but I cann't use this code
below
to
send
email.
Please help me to test this code and instruct me how to solve
this
problem
in detail.
>
>
>
software environment: VS2005 + XP.-- I have disabled firewall
hardware enviornmnet:telcom's modem connects hub,hub connects
two
computers.?-- I also tried to connect computer to modem
directly,but I
can
surf internet, not send email with code.
>
=============================
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 465;
client.UseDefaultCredentials = false;
client.Credentials = new
System.Net.NetworkCredential("uid",
"pwd");
//I also try to use full email address to replace uid. It didn't
work.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
>
System.Net.Mail.MailMessage message = new
MailMessage("ui*@hotmail.com", "ui*@hotmail.com", "Subject",
>
"Body");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
>
try
{
client.Send(message);
Response.Write("Email successfully sent.");
}
catch (Exception ex)
{
Response.Write("Send Email Failed." +
ex.ToString()); ;
}
===============
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Google Mike |
last post by:
I've got RH9 Linux with default PHP.
Is there a way to send email on Linux to an Exchange Server from PHP
and/or other tools when there is *NOT* SMTP access?
Has anyone figured out a way to...
|
by: David Burson |
last post by:
Hi,
I have a VB.NET windows app that needs to automatically send a simple text
email when my users run a new version of the app for the first time. I
thought this would be simple, but after...
|
by: ra294 |
last post by:
I have an ASP.Net application that sends Emails on several pages.
The problem is that when the mail server is down from some reason, the
SmtpMail.Send hangs the application for one minute until I...
|
by: supz |
last post by:
Hi,
I use the standard code given below to send an email from an ASP.NET
web form. The code executes fine but no Email is sent. All emails get
queued in the Inetpub mail queue.
I'm using my...
|
by: hazz |
last post by:
smtpClient.Send(message)
is causing me problems as per specifics in the trace below. Email is sent
but not without this error typically upon sending the second email, but
sometimes when running...
|
by: cj |
last post by:
How can I get a button in VB to send the contents of a text box via
email in a manner similar to the "Send To\Mail Recipient" functionality
that you can select via right clicking a file in Windows...
|
by: Andrew Hunot |
last post by:
I have VB code in VS2003 which creates a HttpWebRequest and performs a POST
operation to a remote URL (an https site), which runs fine and receives a
valid response.
However exactly the same...
|
by: delusion7 |
last post by:
This is what I need to do...
- create an outlook message window (for example: have the outlook window pop-up)
- attach my report1.rdlc to the message
- the attachment(report1.rdlc) needs to...
|
by: Mahernoz |
last post by:
Can i send an email from JavaScript? Is it possible? If yes please the
code to send email using javascript...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |