在ASP.NET的发送电子邮件 [英] Sending email in asp .net

查看:137
本文介绍了在ASP.NET的发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HII
每个人,
我米创建项目
其中Admin是一个用户
我想code或任何想法如何能联系发送任何类型的产品的报价给他
客户虽然对他们的电子邮件ID电子邮件

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

和这个报价已经是一个打印选项按钮
BEC。点击打印按钮,报价应该是打印后

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

我该怎么办呢?

推荐答案

试试这个code这肯定会工作。

try this code surely this will work.

试试这个链接的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);
}

这篇关于在ASP.NET的发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆