2010-03-16 4 views
0

HII каждый, я создаю проект , в котором админы один пользователь Я хочу код или любая идея, как можно администратора отправить коммерческое предложение любого вида продукции к его клиенту, хотя email по электронной почте 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); 
} 
Смежные вопросы