Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2008, 01:54 AM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending Autoamtic Email

Hai
I 'm encountering some problem when i tried to send the email using following code:-

using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Net;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Create a new MailMessage object and specify the "From" and
        "To" addresses
        MailMessage Email = new MailMessage
                         ("my_email_id@gmail.com",TextBox1.Text);
        Email.Subject = "test subject";
        Email.Body = "this is a test";
        SmtpClient mailClient = new SmtpClient();
        //This object stores the authentication values
        NetworkCredential basicAuthenticationInfo = new
               NetworkCredential("my_email_id@gmail.com",
                        "my gmail password");
        //Put your own, or your ISPs, mail server name on this next
        // line
        mailClient.Port = 465;
        mailClient.Host = "smtp.gmail.com";//
                  "smtp.gmail.com"
        mailClient.UseDefaultCredentials = false;
        mailClient.Credentials = basicAuthenticationInfo;
        mailClient.Send(Email);
    }
}

//Text box "TextBox1" contains the email id i'm sending the mail to

The problem i'm encountering is:-
         "The remote name could not be resolved: 'smtp.gmail.com"

Plz help me out as soon as possible!!!!!

 
Old April 10th, 2008, 08:56 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Have you done any testing to see if the URL in question is resolvable on the machine this page is running on?

-Peter
peterlanoie.blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending EMAIL charleshua BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 16 September 3rd, 2008 12:27 AM
Sending email maitias C# 2005 2 February 17th, 2006 11:24 AM
sending email keyvanjan Classic ASP Components 1 May 9th, 2005 05:56 PM
email sending msrnivas .NET Web Services 6 June 26th, 2004 06:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.