-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Girdhar77
Message 3 in Discussion

Hi ,
Below is the code given for mail in C#.For this to work you need to set some
configurations settings for your virtual smtp server.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;

namespace smtpmailtest
{
        /// <summary>
        /// Summary description for WebForm1.
        /// </summary>
        public class WebForm1 : System.Web.UI.Page
        {
                protected System.Web.UI.WebControls.Label lblsend;
                protected System.Web.UI.WebControls.Button btnSend;
        
                private void Page_Load(object sender, System.EventArgs e)
                {
                        // Put user code to initialize the page here
                }

                #region Web Form Designer generated code
                override protected void OnInit(EventArgs e)
                {
                        //
                        // CODEGEN: This call is required by the ASP.NET Web
Form Designer.
                        //
                        InitializeComponent();
                        base.OnInit(e);
                }
                
                /// <summary>
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// </summary>
                private void InitializeComponent()
                {    
                        this.btnSend.Click += new
System.EventHandler(this.btnSend_Click);
                        this.Load += new
System.EventHandler(this.Page_Load);

                }
                #endregion

                private void btnSend_Click(object sender, System.EventArgs
e)
                {
                        //SMTP Mail
                        string mailsub = "testing smtp mail"; // subject 
                        string mailbody = "hello , testing smtp mail"; //
body
                        MailMessage msg = new MailMessage();
                        
                        string to = "[EMAIL PROTECTED]";
                        
                        msg.To = to;
                        msg.From = "[EMAIL PROTECTED]";
                        
                        msg.Subject = mailsub;
                        msg.BodyFormat = MailFormat.Text;
                        msg.Body = mailbody;
                        try 
                        {
                                //Attachment
                                MailAttachment att = new
MailAttachment("d:\\Modification-Oraclefls\\test.doc");
                                msg.Attachments.Add(att);
                                //Mail Server
                                SmtpMail.SmtpServer = "127.0.0.1";
                                //SmtpMail.SmtpServer = "Mail Server
address"
                                
                                        SmtpMail.Send(msg);
                                        lblsend.Text = "Message send to " +
to;
                                
                                
                        }
                        catch(Exception ex)
                        {
                                lblsend.Text = ex.Message.ToString();
                        }
                }
        }
}

-----Original Message-----
From: haideep [mailto:[EMAIL PROTECTED]
Sent: Friday, March 12, 2004 8:28 AM
To: BDOTNET
Subject: Send & Recieve mail in C#


-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: haideep
Message 1 in Discussion

Hi folks,   I've to write a code to send and recieve mail in C#. Can anybody
help me in this case.  If you have any code related to this, just pass it,
it will be helpful to me.   Thanks    deepak  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your
E-mail Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On
the pre-addressed e-mail message that opens, simply click "Send". Your
e-mail address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]
*********************************************************************
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*********************************************************************


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to