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

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

Open
wang-silin opened this issue Jun 10, 2022 · 14 comments
Open
Labels

Comments

@wang-silin
Copy link

当我在中国使用腾讯企业邮箱时,会出现无法连接至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 wang-silin added the bug label Jun 10, 2022
@caronc
Copy link
Owner

caronc commented Jun 18, 2022

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. 👍 .

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&user=abc@xyz.cn&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

@wang-silin
Copy link
Author

我尝试了许多格式,发现似乎是由于腾讯企业邮箱的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:password@xyz.cn?smtp=smtp.exmail.qq.com&to=wsl@xyz.cn
[1] 34
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:00:25,782 - TRACE - E-Mail URL mailtos://abc:password@xyz.cn?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:password@xyz.cn"
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 <abc@xyz.cn>
2022-06-20 12:00:25,795 - DEBUG - Email To: abc@xyz.cn
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:465@xyz.cn?smtp=smtp.exmail.qq.com:465&to=wsl@xyz.cn
[1] 40
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:02:29,287 - TRACE - E-Mail URL mailtos://abc:password:465@xyz.cn?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:password@xyz.cn"
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 <abc@xyz.cn>
2022-06-20 12:02:29,297 - DEBUG - Email To: abc@xyz.cn
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:465@xyz.cn?smtp=smtp.exmail.qq.com&to=wsl@xyz.cn
[1] 37
www-data@9cf0e05879b7:/opt/apprise$ 2022-06-20 12:01:38,385 - TRACE - E-Mail URL mailtos://abc:password:465@xyz.cn?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:password@xyz.cn"
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 <abc@xyz.cn>
2022-06-20 12:01:38,396 - DEBUG - Email To: abc@xyz.cn
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
Copy link
Author

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:password@xyz.cn: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:password@xyz.cn: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:password@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-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 <abc@xyz.cn>
2022-06-27 10:00:06,559 - DEBUG - Email To: abc@xyz.cn
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:password@xyz.cn:465?smtp=smtp.exmail.qq.com
www-data@9cf0e05879b7:/opt/apprise/webapp/static$  apprise -vvvv -t "Test" -b "Email" \ mailtos://abc:password@xyz.cn: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:password@xyz.cn: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:password@xyz.cn: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 abc@xyz.cn against Google Mail
2022-06-27 10:02:15,361 - TRACE - Scanning abc@xyz.cn against Yandex
2022-06-27 10:02:15,361 - TRACE - Scanning abc@xyz.cn against Microsoft Hotmail
2022-06-27 10:02:15,361 - TRACE - Scanning abc@xyz.cn against Microsoft Office 365
2022-06-27 10:02:15,362 - TRACE - Scanning abc@xyz.cn against Yahoo Mail
2022-06-27 10:02:15,362 - TRACE - Scanning abc@xyz.cn against Fast Mail
2022-06-27 10:02:15,362 - TRACE - Scanning abc@xyz.cn against Fast Mail Extended Addresses
2022-06-27 10:02:15,362 - TRACE - Scanning abc@xyz.cn against Zoho Mail
2022-06-27 10:02:15,362 - TRACE - Scanning abc@xyz.cn against SendGrid
2022-06-27 10:02:15,363 - TRACE - Scanning abc@xyz.cn against 163.com
2022-06-27 10:02:15,363 - TRACE - Scanning abc@xyz.cn against Foxmail.com
2022-06-27 10:02:15,363 - TRACE - Scanning abc@xyz.cn 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 <abc@xyz.cn>
2022-06-27 10:02:15,372 - DEBUG - Email To: abc@xyz.cn
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

@caronc
Copy link
Owner

caronc commented Jun 27, 2022

Hmm, I'll investigate more here

@caronc
Copy link
Owner

caronc commented Jul 3, 2022

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?

@wang-silin wang-silin reopened this Jul 6, 2022
@caronc
Copy link
Owner

caronc commented Jul 6, 2022

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.

@wang-silin
Copy link
Author

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:password@xyz.cn:465?smtp=smtp.exmail.qq.com&mode=ssl

mailtos://abc:password@xyz.cn:465?mode=ssl&smtp=smtp.exmail.qq.com

@wang-silin
Copy link
Author

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

@caronc
Copy link
Owner

caronc commented Jul 6, 2022

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 caronc added question and removed bug labels Jul 6, 2022
@caronc
Copy link
Owner

caronc commented Jul 14, 2022

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 caronc closed this as completed Jul 14, 2022
@wang-silin
Copy link
Author

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:password@xyz.cn?smtp=smtp.exmail.qq.com&mode=ssl&port=465"
2022-07-19 12:14:09,505 - TRACE - E-Mail URL mailtos://abc:password@xyz.cn?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:password@xyz.cn"
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 <abc@xyz.cn>
2022-07-19 12:14:09,515 - DEBUG - Email To: abc@xyz.cn
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:password@xyz.cn:465?smtp=smtp.exmail.qq.com&mode=ssl"
2022-07-19 12:11:30,801 - TRACE - E-Mail URL mailtos://abc:password@xyz.cn: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:password@xyz.cn: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 <abc@xyz.cn>
2022-07-19 12:11:30,814 - DEBUG - Email To: abc@xyz.cn
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')

@shanlanCoding
Copy link

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

@caronc caronc reopened this Aug 27, 2023
@caronc
Copy link
Owner

caronc commented Aug 27, 2023

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

@caronc
Copy link
Owner

caronc commented Aug 30, 2024

Hi, is this issue still happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants