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:t elcom'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
Response.Write( "Email successfully sent.");
}
catch (Exception ex)
{
Response.Write( "Send Email Failed." + ex.ToString()); ;
}
=============== 16 4755
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:t elcom'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
Response.Write( "Email successfully sent.");
}
catch (Exception ex)
{
Response.Write( "Send Email Failed." + ex.ToString()); ;
}
===============
"Chef" <Ch**@discussio ns.microsoft.co mwrote in message
news:7A******** *************** ***********@mic rosoft.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:t elcom'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid", "pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
Response.Write( "Email successfully sent.");
}
catch (Exception ex)
{
Response.Write( "Send Email Failed." + ex.ToString()); ;
}
===============
It happend below!
"Send Email Failed.System.N et.Mail.SmtpExc eption: The operation has timed
out. at System.Net.Mail .SmtpClient.Sen d(MailMessage message) at
MainPage.Button 1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePage s\MainPage.aspx .cs:line 94 "
"Mark Rae" wrote:
"Chef" <Ch**@discussio ns.microsoft.co mwrote in message
news:7A******** *************** ***********@mic rosoft.com...
but I cann't use this code below to send email.
What happens when you try...?
"Chef" <Ch**@discussio ns.microsoft.co mwrote in message
news:FF******** *************** ***********@mic rosoft.com...
"Send Email Failed.System.N et.Mail.SmtpExc eption: The operation has timed
out. at System.Net.Mail .SmtpClient.Sen d(MailMessage message) at
MainPage.Button 1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePage s\MainPage.aspx .cs:line 94 "
Indulge me - what does line 94 contain...? I'm assuming it's:
client.Send(mes sage);
client.Send(mes sage); //line 94
"Mark Rae" wrote:
"Chef" <Ch**@discussio ns.microsoft.co mwrote in message
news:FF******** *************** ***********@mic rosoft.com...
"Send Email Failed.System.N et.Mail.SmtpExc eption: The operation has timed
out. at System.Net.Mail .SmtpClient.Sen d(MailMessage message) at
MainPage.Button 1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePage s\MainPage.aspx .cs:line 94 "
Indulge me - what does line 94 contain...? I'm assuming it's:
client.Send(mes sage);
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**@discussio ns.microsoft.co mwrote in message
news:7A******** *************** ***********@mic rosoft.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:tel com'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
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**@discussio ns.microsoft.co mwrote in message
news:7A******** *************** ***********@mic rosoft.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:tel com'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
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**@discussio ns.microsoft.co mwrote in message
news:7A******** *************** ***********@mic rosoft.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:tel com'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.UseDefau ltCredentials = false;
client.Credenti als = new System.Net.Netw orkCredential(" uid",
"pwd");
//I also try to use full email address to replace uid. It didn't work.
client.Delivery Method = SmtpDeliveryMet hod.Network;
System.Net.Mail .MailMessage message = new
MailMessage("ui *@hotmail.com", "ui*@hotmail.co m", "Subject",
"Body");
message.BodyEnc oding = System.Text.Enc oding.UTF8;
message.IsBodyH tml = true;
try
{
client.Send(mes sage);
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 use PHP to get inside an OWA (Microsoft
Outlook Web Access) website to send email that way?
The reason I ask is because my corporate office is going to do away
with our rogue SMTP server access and force everything through Exchange
|
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 days of reading posts and testing, I
see it is not - unless I'm missing something? I'm not an email guru.
All of my users will be running at least Windows 2000, most on XP sp2. Some
of my users will have Outlook, many will be using Outlook...
|
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 get an exception
that the server is not reponsding.
Is there a way to set a timeout for this operation (for example 5 seconds) ?
Is there another solution for it (sending the mail in new thread ?) ?
Thanks
ra294@hotmail.com
|
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 local default SMTP Server and my from address is a valid
Yahoo/Hotmail address. I have configures the local SMTP Server to allow
the IP Address 127.0.0.1.
|
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 the app, even the first time. The application will
be required to be sending out repeated emails, about one every second or
two.
Must this be done asynchronously? Thank you. -Greg
I get the generic error messages;
| |
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 Explorer?
I want the user to click a button and it lunch the users default email
client and put the contents of a multi line text box in the body of the
message and the contents of another text box in the title box and be
sitting there read for...
|
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 code in VS2005 (to the same site with the same
data) causes an exception 'The underlying connection was closed: An
unexpected error occurred on a send.'
Any ideas as to why and what I can do to get around this?
|
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 be a .pdf format
(using c# vs2005 pro team ed.)
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |