Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发送给 gmail.com的时候,会失败! #46

Closed
maxbad opened this issue Nov 22, 2023 · 14 comments
Closed

发送给 gmail.com的时候,会失败! #46

maxbad opened this issue Nov 22, 2023 · 14 comments

Comments

@maxbad
Copy link

maxbad commented Nov 22, 2023

,QQ接收是正常的,
但是gmail会有如下错误:

Messages missing a valid Message-ID header are not
5.7.1 accepted. Please visit
5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant and review
5.7.1 RFC 5322 specifications for more information. j10-20020a63550a000000b005bd6784a9fasi11866943pgb.676 - gsmtp
@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

怎么复现呢,我发给我自己的gmail邮箱是正常的呢

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

我就是下载的发布版程序, 运行在服务器上( centos-7.9.2009 ), 没有绑定域名, IP访问的.

@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

https://github.com/Jinnrry/PMail/releases/tag/v2.3.3

试下这个版本呢,这里面我加了MessageId

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

还是一样的.,这是日志,

[root@beautiful-path-35 PMail]# ./pmail_linux_amd64 
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:76]***************************************************
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:77]*** Server Start Success Version:2.3.3

[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:78]*** Git Commit Hash: d8335fcf5bcdedf0e4d1dbc149c9121008ab287f 
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:79]*** Build TimeStamp: 2023-11-22 19:40:05 
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:80]*** Build GoLang Version: go version go1.21.4 linux/amd64 
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/main.go:81]***************************************************
[debug][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/cron_server/ssl_update.go:62]SSL Check.
[warning][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/res_init/init.go:50]Config File Info:  {"logLevel":"debug","domain":"xxx.xxx.xxx.xxx","domains":["xxx.xxx.xxx.xxx"],"webDomain":"xxx.xxx.xxx.xxx:8080","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"0","SSLPrivateKeyPath":"config/ssl/private.key","SSLPublicKeyPath":"config/ssl/public.crt","dbDSN":"./config/pmail.db","dbType":"sqlite","httpsEnabled":0,"spamFilterLevel":2,"httpPort":8080,"httpsPort":1443,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true}
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:27]POP3 With TLS Server Start On Port :995
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:123]Starting Smtp With SSL Server Port: :465
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/http_server/https_server.go:76]Https Server Start On Port :1443
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:46]POP3 Server Start On Port :110
[info][2023-11-22 19:43:50][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:152]Starting Smtp Server Port: :25
[info][2023-11-22 19:44:30][4131c21c655de99ecbde10b23c122eb0][/home/runner/work/PMail/PMail/server/controllers/email/send.go:53]发送邮件
[warning][2023-11-22 19:44:31][4131c21c655de99ecbde10b23c122eb0][/home/runner/work/PMail/PMail/server/utils/send/send.go:156]SMTP Send Error! Error:550 5.7.1 [xxx.xxx.xxx.xxx] Messages missing a valid Message-ID header are not
5.7.1 accepted. Please visit
5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant and review
5.7.1 RFC 5322 specifications for more information. e6-20020a63d946000000b005b8ebb6d6d7si11873937pgj.117 - gsmtp
[error][2023-11-22 19:44:31][4131c21c655de99ecbde10b23c122eb0][/home/runner/work/PMail/PMail/server/utils/send/send.go:180][0xc000393340] 邮件投递失败550 5.7.1 [xxx.xxx.xxx.xxx] Messages missing a valid Message-ID header are not
5.7.1 accepted. Please visit
5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant and review
5.7.1 RFC 5322 specifications for more information. e6-20020a63d946000000b005b8ebb6d6d7si11873937pgj.117 - gsmtp

@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

https://github.com/Jinnrry/PMail/releases/tag/v2.3.3

我加了个日志,再帮忙试一下呢

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

日志来了

[root@beautiful-path-35 PMail]# ./pmail_linux_amd64 
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:76]***************************************************
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:77]*** Server Start Success Version:2.3.3

[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:78]*** Git Commit Hash: d28bff6f671776033804d1324f8d05e905c7ec45 
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:79]*** Build TimeStamp: 2023-11-22 19:51:53 
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:80]*** Build GoLang Version: go version go1.21.4 linux/amd64 
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/main.go:81]***************************************************
[debug][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/cron_server/ssl_update.go:62]SSL Check.
[warning][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/res_init/init.go:50]Config File Info:  {"logLevel":"debug","domain":"xxx.xxx.xxx.xxx","domains":["xxx.xxx.xxx.xxx"],"webDomain":"xxx.xxx.xxx.xxx:8080","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"0","SSLPrivateKeyPath":"config/ssl/private.key","SSLPublicKeyPath":"config/ssl/public.crt","dbDSN":"./config/pmail.db","dbType":"sqlite","httpsEnabled":0,"spamFilterLevel":2,"httpPort":8080,"httpsPort":1443,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true}
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:27]POP3 With TLS Server Start On Port :995
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:123]Starting Smtp With SSL Server Port: :465
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/http_server/https_server.go:76]Https Server Start On Port :1443
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:152]Starting Smtp Server Port: :25
[info][2023-11-22 19:55:27][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:46]POP3 Server Start On Port :110
[info][2023-11-22 19:56:00][4131c21c655dec5072f310c1c7aebab0][/home/runner/work/PMail/PMail/server/controllers/email/send.go:53]发送邮件
[debug][2023-11-22 19:56:00][4131c21c655dec5072f310c1c7aebab0][/home/runner/work/PMail/PMail/server/utils/send/send.go:114]Message Infos : DKIM-Signature: a=rsa-sha256; bh=K4CRKA/x97T2AwUobWa0sDAKZ69qaMs+vhB/y2BvjKI=;
 c=simple/simple; d=xxx.xxx.xxx.xxx;
 h=Content-Type:Mime-Version:Subject:To:From:Message-Id:Date; s=default;
 t=1700654160; v=1;
 b=djtcGyenopawALCOArFSRoDZd1clTpX/k1QzDfO+rXqAJrgvx5AxWpLLOmwJIc/SI8NRpejC
 i8hVuX+vNckzrwPYUBrqk7nwO3/dMtKkqXwZvAbZdNI8iZKsfxBbBBtQgHUsogfRxnH0EjDDAWN
 yyYxMJBRO4e+N2iECv5zHExE=
Content-Type: multipart/mixed;
 boundary=574f1591de1ba536f1672b22ae7d5abda6d60988c5ae56987304c7efe344
Mime-Version: 1.0
Subject: =?utf-8?q?=E6=88=91=E6=98=AF=E6=A0=87=E9=A2=98?=
To: <emailofzhangsan@gmail.com>
From: "sender" <sender@xxx.xxx.xxx.xxx>
Message-Id: <6>
Date: Wed, 22 Nov 2023 19:56:00 +0800

--574f1591de1ba536f1672b22ae7d5abda6d60988c5ae56987304c7efe344
Content-Type: multipart/alternative;
 boundary=44cd6527c4d930baa8afef9c54eed5bb898dce8543ad63e71683d6013d8c

--44cd6527c4d930baa8afef9c54eed5bb898dce8543ad63e71683d6013d8c
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Type: text/plain; charset=UTF-8

hello,=E6=88=91=E6=98=AF=E5=86=85=E5=AE=B9
--44cd6527c4d930baa8afef9c54eed5bb898dce8543ad63e71683d6013d8c
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Type: text/html; charset=UTF-8

<p>hello,=E6=88=91=E6=98=AF=E5=86=85=E5=AE=B9</p>
--44cd6527c4d930baa8afef9c54eed5bb898dce8543ad63e71683d6013d8c--

--574f1591de1ba536f1672b22ae7d5abda6d60988c5ae56987304c7efe344--

[warning][2023-11-22 19:56:00][4131c21c655dec5072f310c1c7aebab0][/home/runner/work/PMail/PMail/server/utils/send/send.go:158]SMTP Send Error! Error:550 5.7.1 [xxx.xxx.xxx.xxx] Messages missing a valid Message-ID header are not
5.7.1 accepted. Please visit
5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant and review
5.7.1 RFC 5322 specifications for more information. e19-20020a17090a4a1300b00280708b2eaasi1277623pjh.158 - gsmtp
[error][2023-11-22 19:56:00][4131c21c655dec5072f310c1c7aebab0][/home/runner/work/PMail/PMail/server/utils/send/send.go:182][0xc000368140] 邮件投递失败550 5.7.1 [xxx.xxx.xxx.xxx] Messages missing a valid Message-ID header are not
5.7.1 accepted. Please visit
5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant and review
5.7.1 RFC 5322 specifications for more information. e19-20020a17090a4a1300b00280708b2eaasi1277623pjh.158 - gsmtp

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

我看到他们是这样子格式的

腾讯的: Message-ID: <tencent_667FF4063FE7905FD35C8206C38E530BE208@qq.com>
gmail的 : Message-ID: <CAMetxAW8DrrGRsmgo4CHq17z02smgw7-bPK=TiYangroNxiBCA@mail.gmail.com>

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

官方说明是这样子, 示例应该是 :user@example.com 的格式把.

  The message identifier (msg-id) syntax is a limited version of the
   addr-spec construct enclosed in the angle bracket characters, "<" and
   ">".  Unlike addr-spec, this syntax only permits the dot-atom-text
   form on the left-hand side of the "@" and does not have internal CFWS
   anywhere in the message identifier.

https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.4

@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

The message identifier (msg-id) itself MUST be a globally unique identifier for a message. The generator of the message identifier MUST guarantee that the msg-id is unique. There are several algorithms that can be used to accomplish this. Since the msg-id has a similar syntax to addr-spec (identical except that quoted strings, comments, and folding white space are not allowed), a good method is to put the domain name (or a domain literal IP address) of the host on which the message identifier was created on the right-hand side of the "@" (since domain names and IP addresses are normally unique), and put a combination of the current absolute date and time along with some other currently unique (perhaps sequential) identifier available on the system (for example, a process id number) on the left-hand side. Though other algorithms will work, it is RECOMMENDED that the right-hand side contain some domain identifier (either of the host itself or otherwise) such that the generator of the message identifier can guarantee the uniqueness of the left-hand side within the scope of that domain.

嗯,RFC是这样描述的,我又改了一版,你再试试呢

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

日志来了

[root@beautiful-path-35 PMail]# ./pmail_linux_amd64 
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:76]***************************************************
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:77]*** Server Start Success Version:2.3.3

[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:78]*** Git Commit Hash: b1d3c1416434cddb11a9158b97bcc62a335d9955 
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:79]*** Build TimeStamp: 2023-11-22 20:09:46 
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:80]*** Build GoLang Version: go version go1.21.4 linux/amd64 
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/main.go:81]***************************************************
[debug][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/cron_server/ssl_update.go:62]SSL Check.
[warning][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/res_init/init.go:50]Config File Info:  {"logLevel":"debug","domain":"xxx.xxx.xxx.xxx","domains":["xxx.xxx.xxx.xxx"],"webDomain":"xxx.xxx.xxx.xxx:8080","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"0","SSLPrivateKeyPath":"config/ssl/private.key","SSLPublicKeyPath":"config/ssl/public.crt","dbDSN":"./config/pmail.db","dbType":"sqlite","httpsEnabled":0,"spamFilterLevel":2,"httpPort":8080,"httpsPort":1443,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true}
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:123]Starting Smtp With SSL Server Port: :465
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:27]POP3 With TLS Server Start On Port :995
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/http_server/https_server.go:76]Https Server Start On Port :1443
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/smtp_server/smtp.go:152]Starting Smtp Server Port: :25
[info][2023-11-22 20:14:45][/home/runner/work/PMail/PMail/server/pop3_server/pop3server.go:46]POP3 Server Start On Port :110
[info][2023-11-22 20:15:40][4131c21c655df0ec114710ea832f50b0][/home/runner/work/PMail/PMail/server/controllers/email/send.go:53]发送邮件
[debug][2023-11-22 20:15:40][4131c21c655df0ec114710ea832f50b0][/home/runner/work/PMail/PMail/server/utils/send/send.go:114]Message Infos : DKIM-Signature: a=rsa-sha256; bh=JpMYxnGfzEmkPv3Vy6R4T6IFXr0KNnIRhTr3BMCBtho=;
c=simple/simple; d=xxx.xxx.xxx.xxx;
h=Content-Type:Mime-Version:Subject:To:From:Message-Id:Date; s=default;
t=1700655340; v=1;
b=we4s2JqTKy1Fmw0ItAYmp3VOyDuXYVNs1ffrjNAqX7dgoaMMuO6vr4Sa0sk6UDEjqhEEF1wJ
tPodyzpd3ULm4ZLbqsNtWplvTubPbyCEkmqJnew7VZbu+EKulkk9Q8L/G67XzOUKa/fspOCxn0j
9jQLS8/yoNXrjUG7xzsgtNSo=
Content-Type: multipart/mixed;
boundary=e5df117efa6bd1208773e1a6a162adbed34ffd00dca54483b0b7881b4051
Mime-Version: 1.0
Subject: =?utf-8?q?hello,=E6=A0=87=E9=A2=98=E4=BD=A0=E5=A5=BD?=
To: <emailofzhangsan@gmail.com>
From: "sender" <sender@xxx.xxx.xxx.xxx>
Message-Id: <7@xxx.xxx.xxx.xxx>
Date: Wed, 22 Nov 2023 20:15:40 +0800

--e5df117efa6bd1208773e1a6a162adbed34ffd00dca54483b0b7881b4051
Content-Type: multipart/alternative;
boundary=c403930b5b343ba5910dff745b7ae23e5820bcbbcd4b4e266dda26cc616b

--c403930b5b343ba5910dff745b7ae23e5820bcbbcd4b4e266dda26cc616b
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Type: text/plain; charset=UTF-8

hello,=E5=86=85=E5=AE=B9=E4=BD=A0=E5=A5=BD=E5=95=8A!
--c403930b5b343ba5910dff745b7ae23e5820bcbbcd4b4e266dda26cc616b
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Content-Type: text/html; charset=UTF-8

<p>hello,=E5=86=85=E5=AE=B9<span style=3D"background-color: rgb(231, 95, 51=
);"><strong>=E4=BD=A0=E5=A5=BD</strong></span>=E5=95=8A!</p>
--c403930b5b343ba5910dff745b7ae23e5820bcbbcd4b4e266dda26cc616b--

--e5df117efa6bd1208773e1a6a162adbed34ffd00dca54483b0b7881b4051--

[warning][2023-11-22 20:15:41][4131c21c655df0ec114710ea832f50b0][/home/runner/work/PMail/PMail/server/utils/send/send.go:158]SMTP Send Error! Error:550 5.7.26 This mail has been blocked because the sender is unauthenticated.
5.7.26 Gmail requires all senders to authenticate with either SPF or DKIM.
5.7.26 
5.7.26  Authentication results:
5.7.26  DKIM = did not pass
5.7.26  SPF [xxx.xxx.xxx.xxx] with ip: [xxx.xxx.xxx.xxx] = did not pass
5.7.26 
5.7.26  To mitigate this issue, please visit Gmail's authentication guide
5.7.26 for instructions on setting up authentication:
5.7.26  https://support.google.com/mail/answer/81126#authentication l4-20020a632504000000b005c200b11ba3si12352634pgl.888 - gsmtp
[error][2023-11-22 20:15:41][4131c21c655df0ec114710ea832f50b0][/home/runner/work/PMail/PMail/server/utils/send/send.go:182][0xc0003ed300] 邮件投递失败550 5.7.26 This mail has been blocked because the sender is unauthenticated.
5.7.26 Gmail requires all senders to authenticate with either SPF or DKIM.
5.7.26 
5.7.26  Authentication results:
5.7.26  DKIM = did not pass
5.7.26  SPF [xxx.xxx.xxx.xxx] with ip: [xxx.xxx.xxx.xxx] = did not pass
5.7.26 
5.7.26  To mitigate this issue, please visit Gmail's authentication guide
5.7.26 for instructions on setting up authentication:
5.7.26  https://support.google.com/mail/answer/81126#authentication l4-20020a632504000000b005c200b11ba3si12352634pgl.888 - gsmtp

@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

没问题了,SPF和DKIM报错是你域名配置有问题。这两个都需要你设置域名的解析记录

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

嗯,应该是可以了,我是用的IP,没配置域名,
还有个问题就是,启动的时候经常提示端口被占用,实际是没有占用的, 多启动几次就能启动成功!

listen tcp :25: bind: address already in use

@Jinnrry
Copy link
Owner

Jinnrry commented Nov 22, 2023

被占用的时候netstat -tunlop一下呢,这个问题应该和程序无关

@maxbad
Copy link
Author

maxbad commented Nov 22, 2023

嗯,谢谢啦

@maxbad maxbad closed this as completed Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants