Welcome to Dream.In.Code
Become an Expert!

Join 150,166 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,320 people online right now. Registration is fast and FREE... Join Now!




SMTP

 
Reply to this topicStart new topic

SMTP

IceX
27 Aug, 2008 - 10:08 PM
Post #1

New D.I.C Head
*

Joined: 17 Apr, 2008
Posts: 17

Hi all , i have written the source code for emailing the client after they registered with our website ...

here is the code :

CODE

using System;
using System.Data;
using System.Net;
using System.Configuration;
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;
//using System.Net.Mail;

public partial class RegisterSuccessful : System.Web.UI.Page
{

    String email;
    protected void Page_Load(object sender, EventArgs e)
    {
        email = Request.Cookies["Email"].Value;
        //MessageBox.Show(email);

        SmtpMail.SmtpServer = "localhost";
        

        MailMessage mail = new MailMessage();
        mail.To = email;
        mail.Cc = "";
        mail.Bcc = "";
        mail.From = "0606064D@tp.edu.sg";
        mail.Subject = "Registration Verification";
        mail.Body = "Thank You";
            
    
    

        //smtpMail.Host = "MCCCU-PC999";
        try
        {
            SmtpMail.Send(mail);

        }
        catch (Exception ex) { MessageBox.Show("Send Failure"+ex.Message); }
      
    }
}




however , i cannot receive any emails from the website after i registered even though there are no error shown .. i heard that i need to configure the microsoft outlook in order for it to work . am i right ?

my mails are all in the queue of the inetpub mailroot and cannot be sent out ..


and im kinda stuck on the part where i need to enter the Login name and password in configuring the outlook express to be able to send emails..


can some1 help xD thank you .
User is offlineProfile CardPM
+Quote Post

moregoodysplz
RE: SMTP
3 Sep, 2008 - 04:02 PM
Post #2

New D.I.C Head
*

Joined: 3 Sep, 2008
Posts: 4

You should not have to configure Outlook at all? I would try to add this right before your smtpMail.Send(mail) command... (where strUN=UserName, strPW=Password, strSN=ServerName)

CODE

{
    System.Net.Mail.SmtpClient smtpMail = new System.Net.Mail.SmtpClient();
    System.Net.NetworkCredential basicAuthenticationInfo = new Sytem.Net.NetworkCredential(strUN, strPW);
    smtpMail.Host = strSN;
    smtpMail.UseDefaultCredentials = false;
    smtpMail.Credentials = basicAuthenticationInfo;
    (if your server requires ssl connection-->)  smtpMail.EnableSsl = true;
}



QUOTE(IceX @ 27 Aug, 2008 - 11:08 PM) *

Hi all , i have written the source code for emailing the client after they registered with our website ...

here is the code :

CODE

using System;
using System.Data;
using System.Net;
using System.Configuration;
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;
//using System.Net.Mail;

public partial class RegisterSuccessful : System.Web.UI.Page
{

    String email;
    protected void Page_Load(object sender, EventArgs e)
    {
        email = Request.Cookies["Email"].Value;
        //MessageBox.Show(email);

        SmtpMail.SmtpServer = "localhost";
        

        MailMessage mail = new MailMessage();
        mail.To = email;
        mail.Cc = "";
        mail.Bcc = "";
        mail.From = "0606064D@tp.edu.sg";
        mail.Subject = "Registration Verification";
        mail.Body = "Thank You";
            
    
    

        //smtpMail.Host = "MCCCU-PC999";
        try
        {
            SmtpMail.Send(mail);

        }
        catch (Exception ex) { MessageBox.Show("Send Failure"+ex.Message); }
      
    }
}




however , i cannot receive any emails from the website after i registered even though there are no error shown .. i heard that i need to configure the microsoft outlook in order for it to work . am i right ?

my mails are all in the queue of the inetpub mailroot and cannot be sent out ..


and im kinda stuck on the part where i need to enter the Login name and password in configuring the outlook express to be able to send emails..


can some1 help xD thank you .


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:55AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month