2010-03-16 113 views
0

HII 每一個, 餘米創建一個項目 其中管理員是一個用戶 我想代碼或任何想法如何能聯繫發送任何類型的產品的報價單給他 客戶雖然在他們的電子郵件ID中的ASP.NET發送電子郵件

這個報價電子郵件必須是打印選項按鈕 BEC。點擊打印按鈕開盤後應打印

我該怎麼辦呢?

+0

你只需要代碼,以電子郵件的東西嗎?還是你想打印什麼? –

+0

兩者,,我想代碼的郵件文件,它必須有一個打印頁面/文件打印按鈕 – Hussain

+0

@Hussain你解決了這個問題嗎? – BrOSs

回答

1

斯科特谷有一篇文章,這將有助於在Sending Email With System.Mail

+0

我試過了,但它沒有工作 – Hussain

+1

什麼沒有工作?發佈你的確切代碼和你得到的錯誤,並且我們可以提供幫助。 – Josh

5

試試這個代碼肯定這會工作。

嘗試此鏈接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); 
}