Sending Email / smtp.gmail.com (Net.Mail.SmtpClient)

Has anyone, within the past two or three days, successfully sent an email through SMTP.GMAIL.COM using Net.Mail.SmtpClient?

I have several programs that tested OK and now I get error messages ending in "has failed to respond 72.14.247.109:465" (or :587).

Has Gmail "pulled the plug"?

Alternately, if someone provides a different SMTP (and I can sign up for an email account and use it successfully), that will be considered an answer to the question (plus you will have my full gratitude).

-Larry


Larry Dechent - Sampson Coatings

www.wemakebetterpaint.com has 29 examples (C# & VB) to help beginners with ASP.NET.
0
ldechent
3/19/2008 3:34:16 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
1890 Views

Similar Articles

[PageSpeed] 38

Because someone might come to this thread looking for code to make email work, I'll put both code for VB and C# here.

It will be no frills, "bare bones" but a new person starting needs this and can always make it more fancy later.

A special thank you to Hong for getting me to "get going" and take another stab at this.

-Larry


Larry Dechent - Sampson Coatings

www.wemakebetterpaint.com has 29 examples (C# & VB) to help beginners with ASP.NET.
0
ldechent
3/19/2008 5:04:02 PM

ldechent:

UPDATE: I found an old VB code that was my first email send and I got that to work.

 This still doesn't explain why my C# code that worked numerous times suddenly malfunctioned.

 However, I can now do a compare and contrast.  Possibly if I find the difference and see what has to be done to correct the now "defunct" C# code, it could help someone else who comes here with the same problem with which I started.
 My hypothesis that Gmail changed something still stands. 

 

Hi Larry, 

Have you solved your problem?

I found an article talk about this:


 

//This is fully working tested code. Copy and paste the code
//Edit some parts(UserName, password) and ENJOY!
public string sendMail (string from, string to, string cc, string bcc, string subject, string body) {
// Mail initialization MailMessage mailMsg = new MailMessage();
mailMsg.From = from;
mailMsg.To = to;
mailMsg.Cc = cc;
mailMsg.Bcc = bcc;
mailMsg.Subject = subject;
mailMsg.BodyFormat = MailFormat.Text;
mailMsg.Body = body;
mailMsg.Priority = MailPriority.High;
// Smtp configuration SmtpMail.SmtpServer = "smtp.gmail.com";//smtp is :smtp.gmail.com
// - smtp.gmail.com use smtp authentication mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myemail@gmail.com"); mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword");
// - smtp.gmail.com use port 465 or 587
mailMsg.Fields.Add("
http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");//port is: 465
// - smtp.gmail.com use STARTTLS (some call this SSL)
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
// try to send Mail
try { SmtpMail.Send(mailMsg); return "
";
}
catch (Exception ex)
{
return ex.Message;
}
}
 

 

Here is the original link: http://www.codeproject.com/KB/cs/SendMailUsingGmailAccount.aspx

Hope it helps,

Hong Gang 


Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Hong
3/24/2008 8:50:13 AM

The above article does not function, and it leads to a page with more code that does not function.

 It might lead to an idea that will ultimately make this work, but it cannot stand on its own.


Larry Dechent - Sampson Coatings

www.wemakebetterpaint.com has 29 examples (C# & VB) to help beginners with ASP.NET.
1
ldechent
3/24/2008 11:37:04 AM

I may have spoke too soon -- it could be the firewall where I am at--my VB code which works fine on my laptop (through wireless modem) didn't work on my local machine.

(Hoping for the best)


Larry Dechent - Sampson Coatings

www.wemakebetterpaint.com has 29 examples (C# & VB) to help beginners with ASP.NET.
0
ldechent
3/24/2008 12:20:18 PM

 Hi,

 

I was using this functionality successfully until 2 weeks back. since 2 weeks whenver i try to send email through gmail i get follwing error. 

"could not send email because The connetion is actively refused by the server. <IP Address>.

 

Does anybody have any idea why this is happening?

 

Regards,

Rohit 

 

0
rohitjeju
2/5/2009 10:57:08 AM
Reply:

Similar Artilces:

Why do Sending SMTP Authenticated E-mail succeed using SmtpMail.Send() function but fail using SmtpClient.send() function ? Bugs in System.Net.Mail.SmtpClient when send a Authenticated E-mail?
I click btnOK button, the email can send OK, but click btnFail button,  the following error is displayed! why ? you can test the section code. The SMTP, username, password are valid!  Many thanks! "Syntax error, command unrecognized. The server response was: authentication failed,decode user password error" I have tested some other SMTP, somes is OK. I think there are some bugs with System.Net.Mail.SmtpClient when send a Authenticated E-mail with some SMTP!   //------------------------------------------.ASPX Code----------------------------------------...

There was an error sending mail from '......@gmail.com to '.......@gmail.com': Couldn't connect to smtp.gmail.com:465"
Hello Sir, when I am trying to login using other account than Admin. Bugzilla 4.4.4 shows an error like that "There was an error sending mail from '......@gmail.com' to '.......@gmail.com': Couldn't connect to smtp.gmail.com:465". Traceback: at Bugzilla/Mailer.pm line 174. Bugzilla::Mailer::MessageToMTA(...) called at Bugzilla/Token.pm line 299 Bugzilla::Token::Cancel(...) called at Bugzilla/Token.pm line 315 Bugzilla::Token::DeletePasswordTokens(...) called at Bugzilla/Auth/Verify/DB.pm line 63 Bugzilla::Auth::Verify::DB::check_credentials(...) ...

Send Email from form using system.net.mail
Please see code behind below. This my message is being received by only with hard coded text of subject with no body.  How do I correct my syntax so that the information is passed from form fields to email message?  The form data is being inserted into the db and redirected to .aspx page.  Just need to get data from for fields to message.  -------------------------------------------- Imports System.Net.MailPartial Class apps_contactpage Inherits System.Web.UI.PageSub Send2Mail(ByVal sender As Object, ByVal e As FormViewInsertedEventArgs) 'create the mail...

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 e-mail with web form values (vb.net)
I'm sure this is very simple but;I have a form with numerous (<50) textbox controls and related Label controls; ie: <asp:Label ID="Label1" runat="server" Text="Last Name: "></asp:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>When the form is submitted I want to loop through each label control and textbox control and get their Text values for the e-mail without specifying each control. Anyone have suggestions on the best way to do this?Any assistance appreciated greatly!   Here is a solution for you in VB.net:http://www.extremeexperts.com/...

Email switch from Web.Mail to Net.Mail
Hi all, I have currently switched using the .Net 2 Net.Mail At the moment the SMTP Server is located at the same server as the web server. So if I do not specify the IP address for the SMTP then it will use the local machine, the following works: try {System.Web.Mail.MailMessage msgMail = new System.Web.Mail.MailMessage();    msgMail.To = txtTo.Text; msgMail.From = txtFrom.Text;if(!string.IsNullOrEmpty(txtCC.Text)) msgMail.Cc = txtCC.Text; msgMail.Subject = txtSubject.Text;msgMail.BodyFormat = System.Web.Mail.MailFormat.Text; msgMail.Body = txtBody.Text;System.Web.Mai...

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 mails 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 sm As...

Sending Email with System.Net.Mail.SmtpClient but with different message.Sender
 ASP.NET 2.0 vb.netThis seems really odd, I must be missing something really easy. Here is the situation.My web.config file has this:   <system.net>  <mailSettings>   <smtp from="Address@domain.com" >    <network host="mail.domain.com" userName="Address@domain.com" password="pass"/>   </smtp>  </mailSettings> </system.net>   I use that so my membership provider can send emails if someone wants to look up his or her password. It’s all out-of-box functi...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

cannot send email from webpage using System.Net.Mail on external smtp server
Every time I am trying to send email from my webpage, or using passwordrecovery tool , i get following error :: 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 I went through all the existing posts, but none of them worked for me. I have already checked http://www,systemwebmail.com/ web.config settings are as follows <system.net>    <mailSettings>      <smtp from="noreply@allure.com"&g...

.net 2 beta 2 - System.Net.Mail
Hi guysI'm using the System.Net.Mail namespace in .net version 2, beta 2, to send out some HTML formatted e-mails.However, for some reason when the e-mail are sent out some of the full stops from the e-mail are removed.For example, part of the e-mail contains this code<img src="http://www.avonandsomerset.police.uk/images/grey_box_bottom.gif" alt="">But this is what the code is like when the e-mail source code is viewed<img src="http://www.avonandsomerset.police.uk/images/grey_box_bottomgif" alt="">Is this a known bug in beta 2? If so, where can I view a list of known bugs an...

net send in .net
Hi,  I am trying to execute net send comman in my vb.net code. But I am getting "win32 exception unhandled error". Please help me. My code is:Dim psi As New ProcessStartInfo() psi.UseShellExecute = False psi.FileName = "Net send" 'xxx.xxx.xx.xx  - IP address of a system in my network psi.Arguments = "xxx.xxx.xx.xx test" Process.Start(psi)  Thanks in advance! Shwetha Tryu changing   psi.FileName = "Net send" 'xxx.xxx.xx.xx  - IP address of a system in my network psi.Arguments = "xxx.xxx.xx.xx test&quo...

Sending an Email with system.net.mail -- problem with strings and body of the email.
Hi,I am trying to email the contents of a contact form such that the email body looks like this:Last name: Smith First name: John Comment: Test comment. I am using the MailMessage object.I am storing the textbox values in strings://assign values from form to variables   string first = textboxFirst.Text;   string last = textboxLast.Text;   string comment = textboxComment.Text;and then combining the strings into one string for my MaiMessage.Body property.  //create message body from textbox variables     string message = "Last Name: "  + l...

Web resources about - Sending Email / smtp.gmail.com (Net.Mail.SmtpClient) - asp.net.web-forms

Full Featured Email using powershell
... this is a fairly simple, however not quite so well explained – at least that i could find – process. Let us start simply, with the basic SMTPClient ...

Code - eventmachine/eventmachine - Code Climate
Get these same great results for any of your GitHub Repos. 100% free for Open Source, forever Code Climate Login Sign Up with GitHub Pricing ...

Setting of Google Gmail (IMAP, SMTP and POP3) - Coders Grid
Coders Grid your best development resources collections site Menu Skip to content Resource web development design stuffs guideline coding mobile ...

jQuery Contact Tabs Plugin « Design Chemical – jQuery, Wordpress, Tutorials & Plugins
jQuery Contact Tabs Plugin - Create slide out or static contact tabs with customised forms

Sample C# code for SMTP Email - EasySMTP
Send C# email via SMTP with this C# sample code from Easy-SMTP

Ginktage - A technology and Programming Blog on .NET , Delphi , SQL Server and Microsoft related technologies ...
... , Windows Mobile , Android , iOS development using If you need to send emails via SMTP programmatically using C# , you can use the the SmtpClient ...

Private Sub emailTeacher() Try Dim Server As New SmtpClie - Pastebin.com
PASTEBIN - #1 paste tool since 2002 create new paste tools api archive faq PASTEBIN create new paste trending pastes sign up login my alerts ...

CodeSOD: Patterned After Success
... Which is why Andres was getting null reference exceptions when trying to get an instance from this “singleton”. public class SingletonSmtpClient ...

Simple TLS/SSL SMTP client for Qt5 - Rastro-Mania - Coding and Engineering
Projects and tutorials in computer programming and electronics engineering

IIS7 - post #23 - Vista and SMTP server. Where is it?
Where is my SMTP server on Vista? I'm not sure why more developers haven't asked this question. Simple, it is not included - http://blogs.i ...

Resources last updated: 2/5/2016 3:51:19 AM