【问题标题】:sending email with Indy to a gmail address message goes to spam使用 Indy 向 gmail 地址发送电子邮件 消息进入垃圾邮件
【发布时间】:2013-01-07 01:50:24
【问题描述】:

您好,我正在尝试从 delphi (indy) 向 gmail 地址发送消息。当我转到 Gmail 时,我在垃圾邮件文件夹中发现了我的邮件。如果我尝试从 web 使用 PHPMailer 发送相同的消息,它可以正常工作。这是代码。

谢谢

//setup SMTP
SMTP.Port := 25;
SMTP.ConnectTimeout := 1000;
SMTP.Host := 'smtp.xxxxxx.it';
SMTP.Username := 'info@xxxxxx.it';
SMTP.Password := 'xxxxxx';
SMTP.Connect();

if SMTP.Authenticate then
begin
    //setup mail message
    MailMessage.From.Name := 'xxxxxx';
    MailMessage.From.Address := 'info@xxxxxx.it';
    MailMessage.Recipients.EMailAddresses := 'xxxxxx@gmail.com';

    MailMessage.Subject := ledSubject.Text;
    MailMessage.ContentType := 'multipart/mixed';
    htmpart := TIdText.Create(MailMessage.MessageParts, nil);
    htmpart.Body := Body.Lines;
    htmpart.ContentType := 'text/html';

    //send mail
    try
        try
            SMTP.Send(MailMessage);
        except on E:Exception do
            StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
        end;
    finally
        if SMTP.Connected then SMTP.Disconnect;
    end;
end;

【问题讨论】:

  • 那么 Gmail 垃圾邮件过滤器不喜欢您的info@xxxxxx.it 地址。
  • @TLama 也许 GMail 也对电子邮件代理持怀疑态度?问题是从 PHPMailer 发送的邮件不被视为垃圾邮件。
  • @iManBiglari,我错过了。是的,这可能是解决方法。 [+1]

标签: delphi email gmail send indy


【解决方案1】:

我可能已经找到问题所在了。我在“原始模式”中查看消息,在标题中发现 google 显示“MISSING ID”并尝试添加此代码:

    MailMessage.MsgId := '1234567890@drinkmessage.it';
    MailMessage.ExtraHeaders.Values['Message-Id'] := MailMessage.MsgId;

现在它似乎工作正常。

谢谢

【讨论】:

  • 您不需要使用ExtraHeaders 属性,只需使用MsgId 属性本身即可。
【解决方案2】:

您是否尝试过更改IdSMTPHeloNameMailAgent?如果您使用与 PHPMailer 相同的域,我猜 GMail 会将来自您的应用程序的电子邮件视为垃圾邮件,因为它不会检测/不喜欢发送它们的应用程序。

【讨论】:

    猜你喜欢
    • 2017-03-29
    • 2014-06-25
    • 1970-01-01
    • 1970-01-01
    • 2011-08-14
    • 2012-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多