Now able to send authenticated SMTP mail via remote server

Last post 06-09-2008 3:29 AM by yasserzaid. 4 replies.

Sort Posts:

  • Now able to send authenticated SMTP mail via remote server

    01-08-2004, 6:51 AM
    • Member
      30 point Member
    • russlewis
    • Member since 12-21-2003, 11:58 AM
    • Posts 6
    Yes, I can now send authenticated mail via a remote smtp server!

    I dont know who to thank for the code (it was on one of the asp.net/blogs)
    You can read it up on my blog at
    http://stormsoftware.net/blogs/russ/posts/166.aspx
  • Re: Now able to send authenticated SMTP mail via remote server

    01-08-2004, 9:19 AM
    • Contributor
      3,651 point Contributor
    • ScottW
    • Member since 06-10-2002, 8:45 PM
    • New Jersey
    • Posts 730
    • ASPInsiders
    This is already part of .Text 0.95.2004.102 and above.
    Scott Watermasysk, RD, MVP ASP.NET, ASPInsider
    work: http://telligent.com
    blog: http://ScottWater.com/blog
  • Re: Now able to send authenticated SMTP mail via remote server

    01-17-2004, 1:51 PM
    • Member
      25 point Member
    • jimblizzard
    • Member since 06-01-2003, 1:18 PM
    • Florida
    • Posts 5
    Ah, but the question is: how? Where do you provide the userid / password? (I'm still looking through the docs and forums, and hopefully I'll find the answer.)
    bliz | http://jimblizzard.wordpress.com
  • Re: Now able to send authenticated SMTP mail via remote server

    01-17-2004, 2:48 PM
    • Member
      25 point Member
    • jimblizzard
    • Member since 06-01-2003, 1:18 PM
    • Florida
    • Posts 5
    Resolved. See http://snowstormlife.com/blog/archive/2004/01/17/625.aspx.
    bliz | http://jimblizzard.wordpress.com
  • Re: Now able to send authenticated SMTP mail via remote server

    06-09-2008, 3:29 AM
    • All-Star
      15,207 point All-Star
    • yasserzaid
    • Member since 09-22-2007, 9:10 PM
    • Egypt
    • Posts 2,578

    Hi

    Try this example

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Web.Mail;
    
    public partial class SendEmail : System.Web.UI.Page
    {
    string strMailOrTel;
    
    protected void Page_Load(object sender, EventArgs e)
    {
    
    }
    private bool SendMail()
    {
    try
    {
    string strTo = "yor email";
    string strFrom = txtFrom.Text;
    string strBody = txtMessage.Text ;
    string strSubject = txtSubject.Text ;
    SmtpMail.SmtpServer = ("your smtp");
    SmtpMail.Send(strFrom, strTo, strSubject, strBody);
    
    return true;
    }
    catch (Exception ex)
    {
    return false;
    }
    }
    
    protected void btn_Send_Click(object sender, EventArgs e)
    {
    bool TrueOrFalse = SendMail();
    if ((TrueOrFalse == true))
    {
    Response.Redirect("~/MailSent.aspx");
    }
    else
    {
    Label1.Text = "Try again";
    }
    
    }
    
    
    } 
    
     
    Yasser Zaid
    My Blog [http://yasserzaid.wordpress.com/]
Page 1 of 1 (5 items)