Click here to Skip to main content
16,017,100 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hai we are doing real estate project and we heed help for sending mails to the clientrequests :we are using asp.netlaugh:
Posted
Updated 9-Feb-10 22:42pm
v2

Take your pick from this lot[^].
 
Share this answer
 
...or modify this:

C#
using System;
using System.Web.Mail;
namespace WebMail
{
    class Class1
    {
        static void Main(string[] args)
        {
            try 
            {
                MailMessage oMsg = new MailMessage();
                // TODO: Replace with sender e-mail address.
                oMsg.From = "sender@somewhere.com";
                // TODO: Replace with recipient e-mail address.
                oMsg.To = "recipient@somewhere.com";
                oMsg.Subject = "Send Using Web Mail";
                
                // SEND IN HTML FORMAT (comment this line to send plain text).
                oMsg.BodyFormat = MailFormat.Html;
                
                // HTML Body (remove HTML tags for plain text).
                oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
                
                // ADD AN ATTACHMENT.
                // TODO: Replace with path to attachment.
                String sFile = @"C:\temp\Hello.txt";  
                MailAttachment oAttch = new MailAttachment(sFile, MailEncoding.Base64);
  
                oMsg.Attachments.Add(oAttch);
                // TODO: Replace with the name of your remote SMTP server.
                SmtpMail.SmtpServer = "MySMTPServer";
                SmtpMail.Send(oMsg);
                oMsg = null;
                oAttch = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
        }
    }
}
 
Share this answer
 
v2
Hi You can refer to this article:
Send mail using System.Web.Mail namespace
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900