Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 25th, 2008, 10:04 AM
Authorized User
 
Join Date: Jan 2008
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Doom
Default System.Net.Mail Problems With Sending An Email

Here is my code

Code:
using System;
using System.Net;
using System.Net.Mail;

class MainClass
{
    public static void Main()
    {
        {

            //send the message
            SmtpClient smtp = new SmtpClient("smtp.gmail.com");
            smtp.Port = 465;
            smtp.EnableSsl = true;
            //to authenticate we set the username and password properites on the SmtpClient
            smtp.Credentials = new NetworkCredential("doom1992", "MYPASSWORD-THIS IS NOT MY REAL PASSWORD");

            //create the mail message
            MailMessage mail = new MailMessage();

            //set the addresses
            mail.From = new MailAddress("doom1992@googlemail.com");
            mail.To.Add("stevie5@hotmail.co.uk");

            //set the content
            mail.Subject = "This is an email";
            mail.Body = "this is the body content of the email.";
            smtp.Send(mail);
        }
    }
}
I get NO erros in the IDE but the server keeps on timing out.

Can anyone help



Reply With Quote
  #2 (permalink)  
Old May 25th, 2008, 01:35 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Seeing as this compiles it is likely either a networking issue or one to do with the settings you have entered.

Perhaps google requires your full email address in the network credentials line?

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old May 25th, 2008, 01:55 PM
Authorized User
 
Join Date: Jan 2008
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Doom
Default

tried that. It didnt work. It might be somthing to do with the google server. Any Other Suggestions. I will try and do it on my local server. If it works on there that way i will no it is somthing to do with google servers.

Reply With Quote
  #4 (permalink)  
Old May 25th, 2008, 02:49 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Do you have a proxy server perhaps? Otherwise I have no idea I'm afraid.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Net.Mail Problem With Time Out When Sending Adam Thompson Visual Basic 2005 Basics 5 November 10th, 2012 05:24 AM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
embed images in email using system.net.mail Looney Classic ASP Basics 1 June 7th, 2005 05:11 PM
Email not sending with mail() jeffrowe BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 March 1st, 2005 07:23 PM



All times are GMT -4. The time now is 06:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.