apprise icon indicating copy to clipboard operation
apprise copied to clipboard

在中国使用腾讯企业邮箱时,无法连接至smtp服务器

Open wang-silin opened this issue 2 years ago • 14 comments

当我在中国使用腾讯企业邮箱时,会出现无法连接至smtp服务器的情况,服务器域名为smtp.exmail.qq.com(使用SSL,端口号465)。显示错误为 WARNING A Connection error occurred sending Email notification to smtp.exmail.qq.com. 我是用的格式为

  • mailtos://xxx.cn:465?smtp=smtp.exmail.qq.com&user=abc&pass=abc&mode=ssl

在参考了#496 后依然无法解决

When I use Tencent Enterprise Email in China, I cannot connect to the smtp server. The server domain name is smtp.exmail.qq.com (using SSL, port number 465). show error as WARNING A Connection error occurred sending Email notification to smtp.exmail.qq.com.

  • The format I use is mailtos://xxx.cn:465?smtp=smtp.exmail.qq.com&user=abc&pass=abc&mode=ssl

Still can't solve it after referring to #496

wang-silin avatar Jun 10 '22 18:06 wang-silin

I don't think #496 deals with smtp.exmail.qq.com. There were no code changes to include this. If you have a look at #529, you'll see that just Foxmail and 163.com were added.

For Tencent, it looks like you have to provide your own domain and they host your mail service for you? If this is the case, you're going about this the right way. :+1: .

You could try running the command from your terminal (use the apprise CLI tool) with extra verbosity to help you debug your Apprise URL

apprise -vvvv -t "Test" -b "Email" \
   mailtos://xyz.cn:465?smtp=smtp.exmail.qq.com&user=abc&pass=abc&mode=ssl

One thing i can see off hand, is your user is likely the full email address of the account your checking; i can't say this for sure, but most services that host mail servers for people make them log in using their email address. ... so you could try:

apprise -vvvv -t "Test" -b "Email" \
   mailtos://xyz.cn:465?smtp=smtp.exmail.qq.com&[email protected]&pass=abc&mode=ssl
#            ^^^^^^                                     ^^^^^^^
#               |                                          |
#               ------------------------  ==  -------------

Also keep in mind that if your password contains characters that are also part of a WEB URL (such as / or & or %), The password might not be getting properly captured for you. Make sure to escape them (if required). See here

caronc avatar Jun 18 '22 19:06 caronc

我尝试了许多格式,发现似乎是由于腾讯企业邮箱的smtp服务所使用的的端口号是465而不是常见的587,使得无法连接至smtp服务器,我也尝试去指定端口,但是发现并没有生效。 I tried many formats and found that it seems that the port number used by the smtp service of Tencent Enterprise Email is 465 instead of the common 587, which makes it impossible to connect to the smtp server. I also tried to specify the port, but found that it did not take effect.

www-data@9cf0e05879b7:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" \
   mailtos://xyz.cn:465?smtp=smtp.exmail.qq.com&user=abc&pass=password&mode=ssl
[1] 28
[2] 29
[3] 30
[2]-  Done                    user=abc
[3]+  Done                    pass=password
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 11:56:57,299 - TRACE - E-Mail URL mailtos://xyz.cn:465?smtp=smtp.exmail.qq.com unpacked as:
user="None"
password="None"
port="465"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://xyz.cn:465"
qsd="{'smtp': 'smtp.exmail.qq.com'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-06-20 11:56:57,300 - WARNING - Invalid ~From~ email specified: 
2022-06-20 11:56:57,301 - ERROR - Could not load E-Mail URL: mailtos://xyz.cn:465?smtp=s...m
2022-06-20 11:56:57,301 - ERROR - You must specify at least one server URL or populated configuration file.


www-data@9cf0e05879b7:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" mailtos://abc:[email protected]?smtp=smtp.exmail.qq.com&[email protected]
[1] 34
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:00:25,782 - TRACE - E-Mail URL mailtos://abc:[email protected]?smtp=smtp.exmail.qq.com unpacked as:
user="abc"
password="password"
port="None"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]"
qsd="{'smtp': 'smtp.exmail.qq.com'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-06-20 12:00:25,783 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn/?from=abc%40xyz.cn&mode=starttls&smtp=smtp.exmail.qq.com&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-06-20 12:00:25,784 - DEBUG - Using selector: EpollSelector
2022-06-20 12:00:25,785 - INFO - Notifying 1 service(s) asynchronously.
2022-06-20 12:00:25,795 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-06-20 12:00:25,795 - DEBUG - Email To: [email protected]
2022-06-20 12:00:25,796 - DEBUG - Login ID: abc
2022-06-20 12:00:25,796 - DEBUG - Delivery: smtp.exmail.qq.com:587
2022-06-20 12:00:25,797 - DEBUG - Connecting to remote SMTP server...
2022-06-20 12:00:25,914 - DEBUG - Securing connection with STARTTLS...
2022-06-20 12:00:26,062 - DEBUG - Applying user credentials...
2022-06-20 12:00:26,333 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com.
2022-06-20 12:00:26,333 - DEBUG - Socket Exception: (535, b'Error: authentication failed, system busy')


www-data@9cf0e05879b7:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" mailtos://abc:password:[email protected]?smtp=smtp.exmail.qq.com:465&[email protected]
[1] 40
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:02:29,287 - TRACE - E-Mail URL mailtos://abc:password:[email protected]?smtp=smtp.exmail.qq.com:465 unpacked as:
user="abc"
password="password"
port="None"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]"
qsd="{'smtp': 'smtp.exmail.qq.com:465'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
from_addr=""
smtp_host="smtp.exmail.qq.com:465"
headers="{}"
2022-06-20 12:02:29,289 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn/?from=abc%40xyz.cn&mode=starttls&smtp=smtp.exmail.qq.com%3A465&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-06-20 12:02:29,290 - DEBUG - Using selector: EpollSelector
2022-06-20 12:02:29,291 - INFO - Notifying 1 service(s) asynchronously.
2022-06-20 12:02:29,297 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-06-20 12:02:29,297 - DEBUG - Email To: [email protected]
2022-06-20 12:02:29,298 - DEBUG - Login ID: abc
2022-06-20 12:02:29,298 - DEBUG - Delivery: smtp.exmail.qq.com:465:587
2022-06-20 12:02:29,299 - DEBUG - Connecting to remote SMTP server...
2022-06-20 12:02:29,301 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com:465.
2022-06-20 12:02:29,301 - DEBUG - Socket Exception: [Errno -2] Name or service not known


www-data@9cf0e05879b7:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" mailtos://abc:password:[email protected]?smtp=smtp.exmail.qq.com&[email protected]
[1] 37
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:01:38,385 - TRACE - E-Mail URL mailtos://abc:password:[email protected]?smtp=smtp.exmail.qq.com unpacked as:
user="abc"
password="password"
port="None"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]"
qsd="{'smtp': 'smtp.exmail.qq.com'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-06-20 12:01:38,387 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn/?from=abc%40xyz.cn&mode=starttls&smtp=smtp.exmail.qq.com&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-06-20 12:01:38,388 - DEBUG - Using selector: EpollSelector
2022-06-20 12:01:38,389 - INFO - Notifying 1 service(s) asynchronously.
2022-06-20 12:01:38,395 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-06-20 12:01:38,396 - DEBUG - Email To: [email protected]
2022-06-20 12:01:38,396 - DEBUG - Login ID: abc
2022-06-20 12:01:38,396 - DEBUG - Delivery: smtp.exmail.qq.com:587
2022-06-20 12:01:38,397 - DEBUG - Connecting to remote SMTP server...
2022-06-20 12:01:38,492 - DEBUG - Securing connection with STARTTLS...
2022-06-20 12:01:38,603 - DEBUG - Applying user credentials...
2022-06-20 12:01:38,794 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com.
2022-06-20 12:01:38,795 - DEBUG - Socket Exception: (535, b'Error: authentication failed, system busy')

wang-silin avatar Jun 20 '22 12:06 wang-silin

It seems that when parsing parameters, apprise will only parse one parameter at a time and cannot be called at the same time, so it appears that the ssl mode cannot be used when I specify the smtp server, and the smtp server cannot be specified when the ssl mode is used.

似乎在解析参数时,apprise一次只会解析一个参数,无法同时调用,因此出现了当我指定smtp服务器时无法使用ssl模式,当使用ssl模式时无法指定smtp服务器。

www-data@9cf0e05879b7:/opt/apprise/webapp/static$  apprise -vvvv -t "Test" -b "Email" \ mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com&mode=ssl
[1] 159
www-data@9cf0e05879b7:/opt/apprise/webapp/static$ 2022-06-27 10:00:06,548 - TRACE - E-Mail URL mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com unpacked as:
user="abc"
password="password"
port="465"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]:465"
qsd="{'smtp': 'smtp.exmail.qq.com'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-06-27 10:00:06,550 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn:465/?from=abc%40xyz.cn&mode=starttls&smtp=smtp.exmail.qq.com&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-06-27 10:00:06,551 - DEBUG - Using selector: EpollSelector
2022-06-27 10:00:06,552 - INFO - Notifying 1 service(s) asynchronously.
2022-06-27 10:00:06,558 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-06-27 10:00:06,559 - DEBUG - Email To: [email protected]
2022-06-27 10:00:06,559 - DEBUG - Login ID: abc
2022-06-27 10:00:06,559 - DEBUG - Delivery: smtp.exmail.qq.com:465
2022-06-27 10:00:06,560 - DEBUG - Connecting to remote SMTP server...
2022-06-27 10:00:21,643 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com.
2022-06-27 10:00:21,643 - DEBUG - Socket Exception: Connection unexpectedly closed: timed out
^C
[1]+  Exit 1                  apprise -vvvv -t "Test" -b "Email" \ mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com
www-data@9cf0e05879b7:/opt/apprise/webapp/static$  apprise -vvvv -t "Test" -b "Email" \ mailtos://abc:[email protected]:465?mode=ssl&smtp=smtp.exmail.qq.com
[1] 162
www-data@9cf0e05879b7:/opt/apprise/webapp/static$ 2022-06-27 10:02:15,360 - TRACE - E-Mail URL mailtos://abc:[email protected]:465?mode=ssl unpacked as:
user="abc"
password="password"
port="465"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]:465"
qsd="{'mode': 'ssl'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
secure_mode="ssl"
from_addr=""
smtp_host=""
headers="{}"
2022-06-27 10:02:15,361 - TRACE - Scanning [email protected] against Google Mail
2022-06-27 10:02:15,361 - TRACE - Scanning [email protected] against Yandex
2022-06-27 10:02:15,361 - TRACE - Scanning [email protected] against Microsoft Hotmail
2022-06-27 10:02:15,361 - TRACE - Scanning [email protected] against Microsoft Office 365
2022-06-27 10:02:15,362 - TRACE - Scanning [email protected] against Yahoo Mail
2022-06-27 10:02:15,362 - TRACE - Scanning [email protected] against Fast Mail
2022-06-27 10:02:15,362 - TRACE - Scanning [email protected] against Fast Mail Extended Addresses
2022-06-27 10:02:15,362 - TRACE - Scanning [email protected] against Zoho Mail
2022-06-27 10:02:15,362 - TRACE - Scanning [email protected] against SendGrid
2022-06-27 10:02:15,363 - TRACE - Scanning [email protected] against 163.com
2022-06-27 10:02:15,363 - TRACE - Scanning [email protected] against Foxmail.com
2022-06-27 10:02:15,363 - TRACE - Scanning [email protected] against Custom
2022-06-27 10:02:15,363 - INFO - Applying Custom Defaults
2022-06-27 10:02:15,364 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn:465/?from=abc%40xyz.cn&mode=ssl&smtp=xyz.cn&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-06-27 10:02:15,365 - DEBUG - Using selector: EpollSelector
2022-06-27 10:02:15,366 - INFO - Notifying 1 service(s) asynchronously.
2022-06-27 10:02:15,372 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-06-27 10:02:15,372 - DEBUG - Email To: [email protected]
2022-06-27 10:02:15,373 - DEBUG - Login ID: abc
2022-06-27 10:02:15,373 - DEBUG - Delivery: xyz.cn:465
2022-06-27 10:02:15,374 - DEBUG - Connecting to remote SMTP server...
2022-06-27 10:02:15,374 - DEBUG - Securing connection with SSL...
2022-06-27 10:02:30,414 - WARNING - A Connection error occurred sending Email notification to xyz.cn.
2022-06-27 10:02:30,415 - DEBUG - Socket Exception: timed out

wang-silin avatar Jun 27 '22 10:06 wang-silin

Hmm, I'll investigate more here

caronc avatar Jun 27 '22 10:06 caronc

I reviewed your issue and can't seem to reproduce it. If i pass in the arguments you provide, it prepares the mailto:// object as expected.

I'm not quite sure what I'm overlooking here... Can you provide me a URL that for sure does not work for you?

caronc avatar Jul 03 '22 23:07 caronc

Just noticing that this issue is exactly the same as #615. You need to encapsulate your email/url in quotes and it will work fine for you.

caronc avatar Jul 06 '22 16:07 caronc

Sorry, I hit the close button by mistake. I tested and found that it seems that the program cannot read two json commands at the same time. When which command comes first, it will be executed first instead of executing all commands at the same time. Therefore, the correct encryption method cannot be used at the same time when setting the smtp server. This is in It's already reflected in the operating conditions shown in my last message. mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com&mode=ssl

mailtos://abc:[email protected]:465?mode=ssl&smtp=smtp.exmail.qq.com

wang-silin avatar Jul 06 '22 16:07 wang-silin

Could you please give me a sample according to my domain name and smtp server address.

wang-silin avatar Jul 06 '22 17:07 wang-silin

I created this troubleshooting step to help you solve your problem.

The URLs (or at least one of them is probably exactly what you want). Probably the first one you tried. The problem was just that you were losing your data you were passing in after the & because you were testing the URL's without quotes "'s

I think Apprise was lacking documentation to explain this, especially since you're the second to have the problem within the last month or so. So hopefully the new troubleshooting example i added will help you and any others who have a similar problem.

caronc avatar Jul 06 '22 17:07 caronc

Closing issue as the problem relates to just not adding quotes around your URLs. Feel free to open a new ticket or add to this one if you're still having problems.

caronc avatar Jul 14 '22 02:07 caronc

I ran into the following problems

  1. When using the docker container, the English "" cannot be added, resulting in the inability to parse the json correctly. image image image

  2. After I use json to specify port 465, apprise still tries to connect to port 587.

www-data@75e372609f36:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" \ "mailtos://abc:[email protected]?smtp=smtp.exmail.qq.com&mode=ssl&port=465"
2022-07-19 12:14:09,505 - TRACE - E-Mail URL mailtos://abc:[email protected]?smtp=smtp.exmail.qq.com&mode=ssl&port=465 unpacked as:
user="abc"
password="password"
port="None"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]"
qsd="{'smtp': 'smtp.exmail.qq.com', 'mode': 'ssl', 'port': '465'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
secure_mode="ssl"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-07-19 12:14:09,506 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn/?from=abc%40xyz.cn&mode=ssl&smtp=smtp.exmail.qq.com&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-07-19 12:14:09,507 - DEBUG - Using selector: EpollSelector
2022-07-19 12:14:09,508 - INFO - Notifying 1 service(s) asynchronously.
2022-07-19 12:14:09,515 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-07-19 12:14:09,515 - DEBUG - Email To: [email protected]
2022-07-19 12:14:09,515 - DEBUG - Login ID: abc
2022-07-19 12:14:09,515 - DEBUG - Delivery: smtp.exmail.qq.com:587
2022-07-19 12:14:09,516 - DEBUG - Connecting to remote SMTP server...
2022-07-19 12:14:09,516 - DEBUG - Securing connection with SSL...
2022-07-19 12:14:09,620 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com.
2022-07-19 12:14:09,621 - DEBUG - Socket Exception: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)
  1. When everything is configured normally and the password is correct, you cannot connect to smtp.exmail.qq.com
www-data@75e372609f36:/opt/apprise$ apprise -vvvv -t "Test" -b "Email" \ "mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com&mode=ssl"
2022-07-19 12:11:30,801 - TRACE - E-Mail URL mailtos://abc:[email protected]:465?smtp=smtp.exmail.qq.com&mode=ssl unpacked as:
user="abc"
password="password"
port="465"
host="xyz.cn"
fullpath="None"
path="None"
query="None"
schema="mailtos"
url="mailtos://abc:[email protected]:465"
qsd="{'smtp': 'smtp.exmail.qq.com', 'mode': 'ssl'}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="[]"
secure_mode="ssl"
from_addr=""
smtp_host="smtp.exmail.qq.com"
headers="{}"
2022-07-19 12:11:30,804 - DEBUG - Loaded E-Mail URL: mailtos://abc:****@xyz.cn:465/?from=abc%40xyz.cn&mode=ssl&smtp=smtp.exmail.qq.com&user=abc&format=html&overflow=upstream&rto=4.0&cto=15&verify=yes
2022-07-19 12:11:30,805 - DEBUG - Using selector: EpollSelector
2022-07-19 12:11:30,807 - INFO - Notifying 1 service(s) asynchronously.
2022-07-19 12:11:30,814 - DEBUG - Email From: Apprise Notifications <[email protected]>
2022-07-19 12:11:30,814 - DEBUG - Email To: [email protected]
2022-07-19 12:11:30,815 - DEBUG - Login ID: abc
2022-07-19 12:11:30,815 - DEBUG - Delivery: smtp.exmail.qq.com:465
2022-07-19 12:11:30,816 - DEBUG - Connecting to remote SMTP server...
2022-07-19 12:11:30,816 - DEBUG - Securing connection with SSL...
2022-07-19 12:11:30,953 - DEBUG - Applying user credentials...
2022-07-19 12:11:31,118 - WARNING - A Connection error occurred sending Email notification to smtp.exmail.qq.com.
2022-07-19 12:11:31,119 - DEBUG - Socket Exception: (535, b'Error: authentication failed, system busy')

wang-silin avatar Jul 19 '22 12:07 wang-silin

哥们问题解决了吗?我发现使用qq邮箱也是这样的报错。

shanlanCoding avatar Aug 27 '23 01:08 shanlanCoding

Can you share your debugging logs to explain what the problem is that you're getting?

caronc avatar Aug 27 '23 02:08 caronc