我正在尝试通过c++和OpenSSL编写电子邮件客户端应用程序。
当我通过此应用程序检查并发送电子邮件时,Gmail和Yahoo都在我的电子邮件标题中显示错误。

Gmail显示>“dkim = hardfail(测试模式)header.i = @”。

Yahoo显示>“dkim = permerror(错误信号)”。

我的加米尔电子邮件标题:

Delivered-To: [email protected]
Received: by 10.112.41.134 with SMTP id f6csp80981lbl;
        Tue, 26 Mar 2013 02:25:15 -0700 (PDT)
X-Received: by 10.68.59.199 with SMTP id b7mr22705642pbr.167.1364289914515;
        Tue, 26 Mar 2013 02:25:14 -0700 (PDT)
Return-Path: <[email protected]>
Received: from smtp.korcot.info ([103.18.168.250])
        by mx.google.com with SMTP id ak6si16720576pbd.344.2013.03.26.02.25.08;
        Tue, 26 Mar 2013 02:25:14 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning [email protected] does not designate 103.18.168.250 as permitted sender) client-ip=103.18.168.250;
Authentication-Results: mx.google.com;
       spf=softfail (google.com: domain of transitioning [email protected] does not designate 103.18.168.250 as permitted sender) [email protected];
       dkim=hardfail (test mode) [email protected]
Date: Tue, 26 Mar 2013 02:25:14 -0700 (PDT)
DKIM-Signature: v=1;
    a=rsa-sha256;
    s=mail;
    d=korcot.info;
    t=1364289917;
    c=relaxed/relaxed;
    h=from:to:subject:message-id:mime-version:content-type;
    bh=Q3K/t162lFKWTLs4xBY2FR1vT5pThpI6rnqM7i6p/Vo=;
    b=Tgrc2nelY/3HA0M14s4RXFvhonXQzFRtDAD/X/0ITvln6JSWjIxgQSX7WOrfAxb4K
    kTXV+Bbw6DKK+2aVi2WrCYdduP5wXJpTVnjaCJQTs2+DtAo3sL1re6tz3uHOpa0PmRS
    3qRzfXQqN8QczOv63UjAGO6sL+o5atU3vbRYMxg=
From: "Comfirm"<[email protected]>
To: "Kuntal"<[email protected]>
Subject: Key6gg6 ?
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/html

我的Yahoo电子邮件 header :
From Comfirm Wed Mar 27 02:26:20 2013
X-Apparently-To: [email protected] via 106.10.150.84; Tue, 26 Mar 2013 11:26:20 -0700
Return-Path: <[email protected]>
Received-SPF: softfail (transitioning domain of korcot.info does not designate 103.18.168.135 as permitted sender)
 bm5lciByZWFkeSBJcyBkaW5uZXIgcmVhZHkgSXMgZGlubmVyIHJlYWR5IElz
 IGRpbm5lciByZWFkeSBJcyBkaW5uZXIgcmVhZHkgPyBKb2UuIAEwAQEBAQ--
X-YMailISG: v3YQap0WLDt5n8clVc4Zd9ENB5oCUMcfvdmbG1QujbCK18hQ
 nhRHHgRhlvqfyO8lOyt.Rwjm8Y1_i35XTte6Pt.JxYeVZXQtQqLe66qLvndr
 _RhG.PTZE2AWeRN.tMHi.aAIcS9WfKzOzi9i3tYtSSzZMPBMlBwFu5hBV4qI
 v3KO9LCaMGeCe3W4mLsxgbkdddDi_8r8afEb7jAUKVn8i2VyRaJQGELdL5xb
 .lNzJ0h_vMs5HseAhRPefe.o9W4A_oMpcairIa9OfDkC3zmZWYbyntXcxNgi
 uKtvTwaqyeuUvuyIxrRGlpUy8RFxRaLOlp6s8riVCfLyu1dEE6Bpa9KFlVa0
 JtRm0XZ3znl2WBzw1PnHskYZ3X2SHrzz8q7LfmUETa7idziLtkLNqdzZbvJE
 nnoc3W3aYmxkgZob25oRD8Q338f9774TfJMjeqTaQLbmMflOW5GqoPYneB0v
 hKqmdYUcqeZpVfcRXBVSxzS2_lK7spwOJX_wXKAH5TbiRXORouWvbkw9EHgc
 yxqKoTQAqpnc8ibxcfT9cmVQ2KXYXlrl7d0VotpJ.m8I0sMY0mTviVkt6vCI
 FJUYScRuGMxjOaYqyURUU5mDM_bxQXRl1WFzEhYBQKsyMOhZVtBBrPyEsCLs
 NHASPNKPUS7wuB712WAI3aMqTNV.kNize8nwrm.hj9f9fb2nJwcB.IvuQvKx
 Ujd9Pq68B9u80Wd8gtp5rAIy7.B_0x6JHwK14fDWgh1Yr7k1PB8A_daUJh.G
 d2f4rgY0CFbg3chmWC7O5AGvODB79.pFfkl8ooZsUpYqdsj5.KX5XLQjsfud
 JCsO1870Gtty31aPGvSHRPDGOTJ_lQ6v25BMaCnGS8AtvYbtjW9avY0MHTJw
 rnT0_Hzca6oXayZG0CCcvQ6CMd.UnOlIt4pFEWwd9Zlo5BIJ4hd9N99qMbul
 mGgNYVRBc0f7DokmkLiHSI29k34ifNyh8Z1qbeKWTRo4FXDBa.vfc9cVWqpp
 DVF8FbkpuThc7QJ63cszp98TCdZy2Bq5yOMrqEdK85e141MndRChrWmjUplJ
 4e_UWqNmaL17cGPzXuJc3TAD3nsdK9qh1ax.9K.jkRwSm4zgWscqosCPAgOJ
 lIOo3L3QScOP9iQ6xOfuzm7dxw44Z3WBHMthoOgw_MGt488EClyDr2PiJT.f
 1_BklnxGS2iuYH2TLyY69ESKE0Y4pPGmaboLASqBQkQZ6xaoFM8HDoIB20zK
 KrNadXnlkMW.t6RuIcaPX3fOrKzvnKPerZ3NA1kn
X-Originating-IP: [103.18.168.135]
Authentication-Results: mta1360.mail.bf1.yahoo.com  from=korcot.info; domainkeys=neutral (no sig);  from=korcot.info; dkim=permerror (bad sig)
Received: from 127.0.0.1  (HELO smtp.korcot.info) (103.18.168.135)
  by mta1360.mail.bf1.yahoo.com with SMTP; Tue, 26 Mar 2013 11:26:19 -0700
DKIM-Signature: v=1;
    a=rsa-sha256;
    s=mail;
    d=korcot.info;
    t=1364322363;
    c=relaxed/simple;
    h=from:to:subject:mime-version:content-type;
    bh=Q3K/t162lFKWTLs4xBY2FR1vT5pThpI6rnqM7i6p/Vo=;
    b=THj4wE+EOSKThXGIUPBgcTlWTICIDFikgEvlQVpBotViQTNW+k/dpr58kVZ1HAght
    KTdACtbEO2m3A17vxrY1kEQazhwu7pbWIW5TwBfUtIU9SbFBL88AQz2fxxi6BHqEfNh
    WYeGG0mEskG9J2JFeNVG0WaaNJ9gTh5t/4nqvVc=
From: "Comfirm" <[email protected]>
To: "Kuntal" <[email protected]>
Subject: Key6gg6 ?
MIME-Version: 1.0
Content-Type: text/html
Content-Length: 287

我的TXT记录在DNS(godaddy.com)中:

@ >>>> v=spf1 a mx mx:smtp.korcot.info ip4:103.18.168.250 ~all
mail._domainkey >>>> k=rsa; t=y; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCjKsxH3Hb8UrNZ+Aar7GfJ30dcbS19i+89JA8SSlDEhsFfTAR9UZIolxKtD3HgPzhWGfcoLkQg28NS/Y3tT/WTvfXxryDyFRIbKJox6VbVmmvSmATsik1l2YQSkTTpeHX6nzxgzRwDVvmLfZBZBbO3n+y0YNTucOUsfNFYCL/UAwIDAQAB
_domainkey >>>> t=y; o=~;
真的我不知道为什么Gmail和Yahoo会显示“dkim = hardfail(测试模式) header 。i= @” “dkim = permerror(错误信号)” ,两个 header 都应为“dkim = pass” (确定)” ..

所以请给我建议。

请告诉我该怎么做才能解决这个问题。

谢谢...

最佳答案

您没有提到您是使用标准库来计算DKIM签名,还是自己创建了。我强烈建议OpenDKIM作为一个不错的库来使用(如果您还没有的话)。

测试的另一个地方是通过[email protected]将消息发送到邮件反射器。它可能会为您提供更多诊断信息。

您应该检查在最初发送的内容和接收的内容之间签名的 header 字段(“发件人”,“收件人”,“主题”,“MIME版本”和“内容类型”)。一些邮件“有帮助地”重写了这些 header 字段,从而破坏了签名过程。例如,它可能已经签署了[email protected],然后将其更改为[email protected]

10-08 14:35