error message when sending email through Gmail

I got the following error message when I tried to send email through gmail:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

I know the following code is correct because many people use the same code and it works.  I set the POP enabled in the gmail account.  Can anybody tell me what has caused this error?  Thanks in advance.

Dim mail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()

mail.To.Add("aFriend@gmail.com")

mail.Subject = "automatically sent email "

mail.From = New System.Net.Mail.MailAddress("myAccount@gmail.com")

mail.Body = "If you receive this email, it means you don't need your own email server to send email through internet. You may use gmail server. This message has been sent programmatically with GMail."

mail.IsBodyHtml = False

Dim credential As System.Net.NetworkCredential = New System.Net.NetworkCredential("myAccount@gmail.com", "myPassword")

Dim smtp As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("smtp.gmail.com")

smtp.UseDefaultCredentials = False

smtp.Credentials = credential

smtp.EnableSsl = True

smtp.Port = 465 'also tried 587, 25

smtp.Send(mail)


Lynn

Please mark replies that have helped you as answers.
0
lberan
5/23/2008 12:57:29 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

10 Replies
835 Views

Similar Articles

[PageSpeed] 54

Hi,
 I haven't seen any thing wrong in your code.
I think there is firewall issue. Port 587 is correct port for SSL
Do you access your internet via proxy?

Below code works fine at my end

 System.Net.Mail.SmtpClient s = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
         System.Net.NetworkCredential nc = new System.Net.NetworkCredential("mrcarte2", "mrcarte2 Password I mean your gmail password here");
       
        s.EnableSsl = true;
        s.UseDefaultCredentials = false;     
        s.Credentials = nc;
        s.Send("mrcarte2@gmail.com", email, "subject", "Your new password for site http://revenmerchantservices.com/gproteam is :" + newpassword );

Satalaj


Watch The true story of internet ||Yet another forum |||
I'm big fan of Open source flash chart for .net very very simple
I n t e r v i e w T i p s
0
satalaj
5/23/2008 1:12:50 PM

i access internet through local network.  can you explain what setting change i need to make?


Lynn

Please mark replies that have helped you as answers.
0
lberan
5/23/2008 1:52:42 PM

yes, i access gmail through outlook.


Lynn

Please mark replies that have helped you as answers.
0
lberan
5/23/2008 2:08:42 PM

Do you have any firewall / antivirus installed which might be blocking the ports being opened using unknown new applications? if yes Can you search for the logs


Watch The true story of internet ||Yet another forum |||
I'm big fan of Open source flash chart for .net very very simple
I n t e r v i e w T i p s
0
satalaj
5/23/2008 2:12:29 PM

i think i have firewall and anti-virus software.  but i don't know how to search for the logs and what to look at. 


Lynn

Please mark replies that have helped you as answers.
0
lberan
5/23/2008 2:17:59 PM

Can you disable them and check.. .?
You need to Unblock all traffic or something like that might be there on those application. which I can suspect


Watch The true story of internet ||Yet another forum |||
I'm big fan of Open source flash chart for .net very very simple
I n t e r v i e w T i p s
0
satalaj
5/23/2008 2:20:35 PM

i acutally found the logs but i don't have permission to open them.  neither do i have permission to disable them.  guess this is beyond my control.  thanks for your replies.


Lynn

Please mark replies that have helped you as answers.
0
lberan
5/23/2008 2:29:56 PM

 Whenever I try to send an email using my app with gmail smtp server it throws following exception

Could not connect to mail server because connection was actively refused by server <ip address>

 

do you have any idea? 

0
rohitjeju
2/5/2009 10:45:06 AM

See if this can help you, its related with Google SMPT Server sending mail

http://forums.asp.net/t/1371357.aspx


Thanks And Regards,
Manoj Karkera
Zenith Software LTD

Please remember to click “Mark as Answer” on the post that helps you
0
manoj0682
2/5/2009 10:51:25 AM
Reply:

Similar Artilces:

send web email from web form error help
Hi, When send email with attachment from web form. I got an error message as below. What it is? Can someone help? Server Error in '/dotNet' Application. -------------------------------------------------------------------------------- The transport lost its connection to the server. Hi There, Please check the following link The transport failed to connect to the server Hope this helps Sunny NAGIProper Preparation Prevents Poor PerformanceDont forget to click "Mark as Answer" on the post that helped you....

Sending an Email message from a web form
I used pretty typical code copied from an example: Dim MailMsg As New MailMessageMailMsg.To = "xxx@verizon.net"MailMsg.Subject = TextBoxSubject.TextMailMsg.Body = TextBoxMessageText.TextMailMsg.From = TextBoxAddr.TextSmtpMail.SmtpServer = "localhost"SmtpMail.SmtpServer = "outgoing.verizon.net"SmtpMail.Send(MailMsg)I am on a home PC, with DSL provider Verizon.  Outlook is working for me to send/receive mail.When i tried SmtpMail.SmtpServer= "localhost", i got the following exception:The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to ...

Send email error from my web form question
I keep getting this fatal error when I try to send email from my web form internally.  For some reason, when I set the (to) address to a valid email address that is external it works, but when I try sending a valid email internally it will not work.  I even broke the mail function down to the bare minimum to send a sample email.  I even hard coded the addresses right in the (to) and (from) fields.  No matter what I try, it produces the same results.  If I change the (to) email address to anything external, it will work perfectl...

error message when sending email through gmail #2
i got the error message when i tried to send email through gmail:   The operation has timed out. The operation has timed out. this is my code:Dim mail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage() mail.To.Add("aFriend@gmail.com")mail.Subject = "automatically sent email " mail.From = New System.Net.Mail.MailAddress("myAccount@gmail.com") mail.Body = "If you receive this email, it means you don't need your own email server to send email through internet. You may use gmail server. This message has b...

Sending Email with Net.Mail (No Email, no error)
hi,i'm using the system.net.Mail namespace to send an email from my application. when i send, the application does not fire any exception, neither does it send the email to my account.below is the code i'm using  Dim mmailMessage As New Net.Mail.MailMessage Dim mFrom As New Net.Mail.MailAddress(mailFrom) mmailMessage.From = mFrom Dim ll As String = "myname@ourmail.com" mmailMessage.To.Add(ll) mmailMessage.Subject = "Talk Concerns" mmailMessage.Body = "Testing Concerns One Two" Dim ...

Sending Email from web page-send.objmm error
when icomile the code th folowing error come .I have downloaded the code from http://www.4guysfromrolla.com/webtech/080801-1.shtml .and run it but it give me followin error . ****************************************************** The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is in...

Submitting Web forms fields to sql database by clicking on SUBMIT FORM and sending the form fields to email box
I have a created or designed a form to be stored in a SQL database table and at the same time when a user clicks on SUBMIT button the form fields will automatically goto the visitor email address immediately. Also i have created a database with tables for each of this forms Pls help i have over 10 forms designed but the problem of submitting them to the table database and the user email address is the challenge now.... You ned to familiarise yourself with the basics of database access in ASP.NET.  There are free tutuorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/da...

C# email form doesn't send email, but no compilation errors
I'm trying to get an email form to work.  It is a feedback form.  I wrote it in C#. The existing code returns no compilation errors and appears to work, but the email never gets delivered.  Is there something simple I'm forgetting about?  The email is a godaddy account.  I'm not sure if that has anything to do with it, but godaddy didn't help me at all so now I'm at a loss on what to do next. <%@ Page Language="C#" Explicit="true" MasterPageFile="~/MasterPage.master" %><%@ Import NameSpace="System....

Sending Email through System.Net.Mail is generating errors "Failure Sending mail
hi Sending Email through System.Web.Mail is working fine but System.Net.Mail is generating errors "Failure Sending mail  i treid in all possible ways but did't  pls help in giving a solution thanks & Regards vittal Maybe you can show us some code and post the exact error mesg as well (by looking at the value in ex.tostring)?My HomePage - www.findingsteve.net"It is more blessed to give than to receive." Acts 20: 35 (NIV, Bible)Progress - "Never discourage anyone...who continually makes progress, no matter how slow." Plato System.Web.Ma...

Send the web form to an email
I have made a web page. The user need to fill the web page and on submit button the form need to be send the email. But my problem is that I have to send the page as it looks like with the data filled by the user. You can create a link for viewing the filled form. On click on the submit button the link should be sent in the email. Ensure all textboxes are readonly on the page when the user is viewing the entered values. Thank You~B  Saurav Bhadani:I have made a web page. The user need to fill the web page and on submit button the form need to be...

error message when sending an email
Hello. I'm trying to send an email from one acocunt to another to test but I'm getting this error. The connection to the server has failed. Account: 'mail.MyName.org', Server: 'mail.MyName.org', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10060, Error Number: 0x800CCC0E I I understand the error message but how do I get rid of the socket error? I'm using outlook express 6 and windows xpsp2 to do this. Thanks. "marrie" <SA@mailinator.com> wrote in message news:el78e3$m5f$1@news.grc.com... > Hello. I'm trying to s...

Error message sending an email
This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C62274.7EE67120 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I am new to the bugzilla system and this is probably a trivial setup question. I've installed bugzilla on Windows 2003 Server with Apache running on it. I also have IIS running on the same machine for other purposes, but it's not used by bugzilla. I followed the step by step instructions at this site: http://www.bugzilla.org/docs/win32install.html I am able to access bugzilla an...

Error message on a web form
I am trying to generate text onto a form that is a view only form, but instead of getting the name for a unit I am getting a numeric value instead and I am trying to convert that numeric value into an alpha value. But I am running into an error message: "Column 'CCSC_Unit' does not belong to table CCSCUnit." What am I missing or doing wrong? Thanks ------------------------------------------------------------------------------------------------------ Public Sub GenerateText() Dim connString1 As String = ConfigurationSettings.AppSettings("connString1") '...

Send email from web form???
Hi there .. Iam trying to send email using SmtpMail Component but i get this error at runtime "The "SendUsing" configuration value is invalid" here is the code MailMessage myMailMessage = new MailMessage(); myMailMessage.From = "wafi_m@hotmail.com"; myMailMessage.To = "wafi_mohtaseb@yahoo.com"; myMailMessage.Subject = "User Name and Password"; myMailMessage.Body = "Your Username : wafi and <br> Password : wafi"; myMailMessage.BodyFormat = MailFormat.Html; SmtpMail.Send(myMailMessage); any...

Web resources about - error message when sending email through Gmail - asp.net.web-forms

Message - Wikipedia, the free encyclopedia
A message is a discrete unit of communication intended by the source for consumption by some recipient or group of recipients. A message may ...

Heeding the message of respect to women
Readers discuss Chris Gayle's controversial comments to television presenter Mel McLaughlin. While some believe his words were inappropriate ...

The Town of Light: A psychological thriller with a mental health message
Despite how common mental health problems can be, understanding them, or even just discussing them without prejudice, is something of a modern ...

Saudi Executions That Riled Iran Meant as Domestic Message
Saudi Arabia’s execution of 47 men last weekend quickly became an international drama, agitating markets and triggering a flare-up with longtime ...

Veteran dies hours after posting hopeful New Year's Eve message
Before dying in New Year's crash, victim says "where I windup is where I'm meant to be"

Yahoo must face class action over text messages: U.S. judge
The lawsuit accused the Internet company of sending unsolicited text messages to more than 500,000 Sprint cellphone users.

A Message From The Year 2026 About The Future Of Your TV
Thirty years ago, in 1996, you actually used your TV to watch broadcast or cable signals — live, as things aired. Twenty years ago, in 2006, ...

Former NFL Player Shaun Smith Has A Message For Trolls: Look At This Gun
Shaun Smith, a defensive lineman who last played for the Chiefs, rattled off a couple of thoughts today about Kansas City’s upcoming playoff ...

Carey Hart Posts Adorable Message to Wife Pink on Their 10th Wedding Anniversary
Carey Hart Posts Adorable Message to Wife Pink on Their 10th Wedding Anniversary

New Gmail Plug-In Highlights Words And Phrases That Undermine Your Message
The Chrome extension called "Just Not Sorry" warns you when your messages contain wishy-washy language like "I'm no expert" or "sorry, but." ...

Resources last updated: 1/8/2016 12:56:24 PM