簡體   English   中英

使用C#Web應用程序中的MAPI在ASP.NET中使用默認Web客戶端發送郵件

[英]Send mail using default webclient in ASP.NET using MAPI in C# web application

我正在使用MAPI在C#Web應用程序中打開默認Web郵件客戶端。 現在,它首先作為對話框打開,然后作為Outlook窗口打開。 我想使用MAPI打開直接默認郵件客戶端窗口。

但是,當我在IIS上進行部署時,MAPI不會調用“郵件對話框”。

是否有使用帶有附件的MAPI調用Web郵件客戶端的簡單方法?

不要使用MAPI。 使用System.Net.Mail: http : //www.systemnetmail.com/faq/3.4.1.aspx

static void AttachmentFromFile()
{
    //create the mail message
    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress("me@mycompany.com");
    mail.To.Add("you@yourcompany.com");

    //set the content
    mail.Subject = "This is an email";
    mail.Body = "this content is in the body";

    //add an attachment from the filesystem
    mail.Attachments.Add(new Attachment("c:\\temp\\example.txt"));

    //to add additional attachments, simply call .Add(...) again
    mail.Attachments.Add(new Attachment("c:\\temp\\example2.txt"));
    mail.Attachments.Add(new Attachment("c:\\temp\\example3.txt"));

    //send the message
    SmtpClient smtp = new SmtpClient("127.0.0.1");
    smtp.Send(mail);

}

您要在服務器端的客戶端上執行此操作嗎? 我懷疑您是否希望在沒有人會關閉這些窗口的服務(IIS)中運行時在服務器上顯示任何窗口。 如果要在客戶端上運行,mailto:url幾乎是您唯一的選擇。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM