0

hii every one, I m creating an project in which Admin is one user I want code or any idea how can Admin send a quotation of any type of products to his customer though email on their email ID

and this quotation has to be a print option button bec. after clicking on print button quotation should be print

How can i do it?

3
  • Do you just need code to e-mail something? Or are you trying to print something? Commented Mar 16, 2010 at 16:32
  • both ,, I want code for mail file in which it must have a print button for print page/file Commented Mar 16, 2010 at 16:35
  • @Hussain did you solve the issue ? Commented Nov 1, 2012 at 18:59

2 Answers 2

5

try this code surely this will work.

Try this link http://www.dotnetspider.com/projects/577-Send-Mail-with-Attachments-using-Gmail.aspx

/// <summary>
    /// Sends an mail message
    /// </summary>
    /// <param name="from">Sender address</param>
    /// <param name="to">Recepient address</param>
    /// <param name="bcc">Bcc recepient</param>
    /// <param name="cc">Cc recepient</param>
    /// <param name="subject">Subject of mail message</param>
    /// <param name="body">Body of mail message</param>
    public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
    {
        // Instantiate a new instance of MailMessage
        MailMessage mMailMessage = new MailMessage();
        // Set the sender address of the mail message
        mMailMessage.From = new MailAddress(from);
        // Set the recepient address of the mail message
        mMailMessage.To.Add(new MailAddress(to));

    // Check if the bcc value is null or an empty string


  if ((bcc != null) && (bcc != string.Empty))
    {
        // Set the Bcc address of the mail message
        mMailMessage.Bcc.Add(new MailAddress(bcc));
    }
    // Check if the cc value is null or an empty value
    if ((cc != null) && (cc != string.Empty))
    {
        // Set the CC address of the mail message
        mMailMessage.CC.Add(new MailAddress(cc));
    }       // Set the subject of the mail message
    mMailMessage.Subject = subject;
    // Set the body of the mail message
    mMailMessage.Body = body;

    // Set the format of the mail message body as HTML
    mMailMessage.IsBodyHtml = true;
    // Set the priority of the mail message to normal
    mMailMessage.Priority = MailPriority.Normal;

    // Instantiate a new instance of SmtpClient
    SmtpClient mSmtpClient = new SmtpClient();
    // Send the mail message
    mSmtpClient.Send(mMailMessage);
}
Sign up to request clarification or add additional context in comments.

Comments

1

Scott Gu has an article that will help on Sending Email With System.Mail

1 Comment

What didn't work? Post your exact code and the error you got, and perhaphs we can help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.