日期:2014-05-18  浏览次数:20431 次

服务器端打开Outlook窗口发送邮件的问题
我现在想写一个通用的函数,通过参数得到邮件的信息,然后启动outlook界面自动填入内容。
我在windows程序里面,可以通过process.start("mailto:*****")实现,但是在web里面怎么实现?
虽然我知道通过<a href="mailto:****>mail</a>就可以了,但是我希望通过后台的程序实现而不是前台的超级链接。

------解决方案--------------------
Imports System.net
Imports System.Net.Mail
Imports System.Net.Configuration
Imports System.Configuration
Imports System.Configuration.ConfigurationManager
Imports System.Web.Configuration

<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="">
<network host="smtp.263xmail.com" userName="" password=""/>
</smtp>
</mailSettings>
</system.net>

subject,body 是asp:textbox
mailto 是 appSettings中的配置


 Dim ToAddress As String = System.Configuration.ConfigurationManager.AppSettings("mailto").ToString
using As New MailMessage(NetSectionGroup.GetSectionGroup(WebConfigurationManager.OpenWebConfiguration("~/web.config")).MailSettings.Smtp().From, ToAddress, subject.Text, body.Text)

 Dim smtp As New SmtpClient
smtp.Send(mail)

end using
------解决方案--------------------
??不是很明白你的意思。
需要后台实现什么?
如果用后台发邮件的话直接可以用微软的SMTP类去发送邮件啊,不一定要打开Outlook才能发邮件的。
------解决方案--------------------
你变通个方式啦,像比如:
private void page_load(...)
{
button1.Attributes.Add("onclick", "window.open('mailto:aaa@aa.com')");
}
又或者RegisterClientScriptBlock(..)