使用.NET中的SmtpClient和MailMessage类通过本地邮件服务器(hMailServer)发送电子邮件,我当前发现无法获取已Message-ID发送邮件的标头值.
背后的想法
我正在尝试以编程方式跟踪无法传递的邮件,因此我必须找到一种方法来识别来自目标SMTP服务器的拒绝某个邮件的回复.
现在我想到只记住Message-IDSMTP标头值并解析此ID的传入邮件.
我发送消息后试图检查Headers集合,但我没有找到任何消息Message-ID.
我的问题
是否可以获取Message-ID我的SMTP服务器在发送MailMessage实例期间添加的标头值?
更新2012-05-27
根据这个例子,我成功地尝试Message-ID在发送之前自己手动生成一个.
到目前为止,我的所有示例都有效,所以这似乎是我的问题的解决方案.
我只是想让我的hmailserver从我的C#程序发送邮件.杀死我的部分是SSL部分.
我最初得到这个错误: The SMTP server requires a secure connection or the client was not authenticated. The server response was: SMTP authentication is required.
所以我补充说:smtp.EnableSsl = true; 现在我明白了Server does not support secure connections.
这是我的代码,这让我疯了.我是否必须创建自己的SSL或者是否有办法在hmailserver端禁用SSL?
MailMessage mail = new MailMessage("jlnt@ademo.net", "com", "NEW Item", emailBody);
SmtpClient smtp = new SmtpClient("1.1.1.250");
smtp.Port = 25;
NetworkCredential login = new NetworkCredential("ja@test.net", "dg");
smtp.Credentials = login;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Send(mail);
Run Code Online (Sandbox Code Playgroud) 我安装了hMailServer并执行了以下操作
1. Created a test.com domain
2. Added an user testuser
Run Code Online (Sandbox Code Playgroud)
现在hMailServer正在我的localhost中运行.
当我安装Mozilla雷鸟并尝试通过输入用户名和密码来配置它时,它无法给出
Thunderbird failed to find the settings for your email account.
Run Code Online (Sandbox Code Playgroud)
如何告诉thunderbird我在本地主机上运行的hMailServer?当我进入testuser@test.com时,thunderbird在哪里寻找域名?
我看到了一些消息,比如"在Mozilla ISP数据库中查找".但是邮件服务器在我的本地机器上.
我错过了任何配置细节吗?
亲爱的先生,我尝试在家用电脑上制作网络邮件服务器.所以我下载并安装了hmailserver.但是当我尝试连接它时.它有"与数据库的连接不可用"的错误
当我看到日志文件时,它有以下错误.请帮助我
"ERROR" 2920 "2013-10-02 01:00:58.431" "Severity: 1 (Critical), Code: HM5094, Source: MySQLInterface::Load, Description: Error:[nl]The MySQL client (libmysql.dll, 32 bit) could not be loaded.[nl]hMailServer needs this file to be able to connect to MySQL.[nl]The MySQL client needs to be manually copied to the hMailServer Bin directory. The file is not included in the hMailServer installation.[nl]Path: C:\Program Files (x86)\hMailServer\Bin\libmysql.dll"
"ERROR" 2920 "2013-10-02 01:00:59.675" "Severity: 1 (Critical), Code: HM5094, Source: MySQLInterface::Load, Description: Error:[nl]The MySQL client (libmysql.dll, 32 bit) could not be loaded.[nl]hMailServer …Run Code Online (Sandbox Code Playgroud) 我试图建立hMailServer在"Windows Server 2008企业版Service Pack 1" .I've设置hMailServer,阿帕奇,PHP和Webmail界面"AfterLogic的webMail" successfully.And一切工作well.But我被困在同时问题我试图安装" PHPWebAdmin ".错误信息如下:
Fatal error: Class 'COM' not found in E:\Server\wwwroot\PHPWebAdmin\initialize.php on line 13
Run Code Online (Sandbox Code Playgroud)
访问"http://192.168.2.66:8088/PHPWebadmin/"时会出现此信息.
我已经配置PHP配置文件php.ini选项如下:
[PHP]
register_globals = Off
display_errors = Off
doc_root = "E:/Server/wwwroot"
extension_dir = "E:/Server/php5_4_5/ext"
[Session]
session.save_path = "E:/Server/php5_4_5/tmp"
[COM]
com.allow_dcom = true
Run Code Online (Sandbox Code Playgroud)
我也完成了这些事情,因为hMailServer手册建议:
DCOM permissions
Overview
By default, IIS6 is not allowed to connect to hMailServer because of the Distributed COM permissions that Windows uses. Also, Apache run as a user account with restricted permissions …Run Code Online (Sandbox Code Playgroud) 我有一个asp页面,通过电子邮件使用CDO发送表单的详细信息.到目前为止,我已经通过与hmail服务器的明确连接使用smtp端口25完成了此操作.
我现在需要使用SSL连接.我创建了一个安全证书并设置了hmail服务器以使用端口465和ssl.
但是,出于某种原因,当我尝试发送表单时,我收到错误500并且未发送电子邮件.
我也试过端口587,但它也不起作用.
我使用的CDO代码如下:
If request.Form("submit") <> "" then
Set myMail=CreateObject("CDO.Message")
myMail.Subject="xxxxxxx"
myMail.From=Request.Form("email")
myMail.To= "xxxxxxxxxxx"
myMail.TextBody = "Name:"& Request.Form("name")& vbcrlf & vbcrlf & _
"Email:" & Request.Form("email") & vbcrlf & vbcrlf & _
"Telephone:" & Request.Form("telephone") & vbcrlf & vbcrlf & _
"Location:" & Request.Form("location") & vbcrlf & vbcrlf & _
"Other location:" & Request.Form("other_location") & vbcrlf & vbcrlf & _
"Comments:" & Request.Form("comments")
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="127.0.0.1" …Run Code Online (Sandbox Code Playgroud) 尽管将 php.ini 配置为有效的 send_from 地址,我还是收到此错误。我知道它是有效的,因为当我从 squirrel mail 发送邮件时它可以工作,但是当我用 php 发送邮件时它就不起作用。无效地址大概是指 send_from 地址。所以我不明白它怎么会认为这是错误的。这是 php 代码:
$email="tobiasvogel1@googlemail.com";
$subject = "Your New Password";
$from="admin@dayshare.local";
$message = "Your new password is as follows:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
This email was automatically generated.";
if(!mail($email, $subject,$message,$from)){
echo ("error");
}else echo "success";
Run Code Online (Sandbox Code Playgroud)
在 php.ini 中:
SMTP = localhost
sendmail_from = admin@dayshare.local
Run Code Online (Sandbox Code Playgroud) hmail-server ×7
smtp ×3
c# ×2
php ×2
.net ×1
cdo.message ×1
dcom ×1
email ×1
mailmessage ×1
ssl ×1
thunderbird ×1