You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/06/18 21:26:55 UTC
[GitHub] [dolphinscheduler] qxiong522 opened a new issue #5661: [Question] Question title
qxiong522 opened a new issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661
**Describe the question**
邮件告警发送失败
1. 以下配置:
```
MAIL_PROTOCOL=SMTP
MAIL_SERVER_HOST=smtp.163.com
MAIL_SERVER_PORT=25
MAIL_SENDER=147xxxx009@163.com
MAIL_USER=147xxxx009@163.com
MAIL_PASSWD=xxxxxx
MAIL_SMTP_STARTTLS_ENABLE=false
MAIL_SMTP_SSL_ENABLE=false
MAIL_SMTP_SSL_TRUST=
```
可以发送成功
如果 `MAIL_SMTP_STARTTLS_ENABLE=true` 失败
失败代码:
```
dolphinscheduler-alert_1 | org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.163.com:25
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.send(Email.java:1496)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.getStringObjectMap(MailUtils.java:321)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.sendMails(MailUtils.java:136)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.manager.EmailManager.send(EmailManager.java:39)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.plugin.EmailAlertPlugin.process(EmailAlertPlugin.java:101)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.runner.AlertSender.run(AlertSender.java:84)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.start(AlertServer.java:82)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.main(AlertServer.java:89)
dolphinscheduler-alert_1 | Caused by: javax.mail.MessagingException: Could not convert socket to TLS
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2155)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:752)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:388)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:246)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:195)
dolphinscheduler-alert_1 | at javax.mail.Transport.send0(Transport.java:254)
dolphinscheduler-alert_1 | at javax.mail.Transport.send(Transport.java:124)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
dolphinscheduler-alert_1 | ... 8 common frames omitted
dolphinscheduler-alert_1 | Caused by: java.io.IOException: Server is not trusted: smtp.163.com
dolphinscheduler-alert_1 | at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:638)
dolphinscheduler-alert_1 | at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:553)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2150)
dolphinscheduler-alert_1 | ... 15 common frames omitted
```
2. 更换以下配置
```
MAIL_PROTOCOL=SMTP
MAIL_SERVER_HOST=smtp.partner.outlook.cn
MAIL_SERVER_PORT=25 (587 也试了,错误一样)
MAIL_SENDER=no-reply@xxxx.com
MAIL_USER=no-reply@xxxx.com
MAIL_PASSWD=xxxxx
MAIL_SMTP_STARTTLS_ENABLE=false
MAIL_SMTP_SSL_ENABLE=false
MAIL_SMTP_SSL_TRUST=
```
发送失败
```
dolphinscheduler-alert_1 | org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.partner.outlook.cn:25
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.send(Email.java:1496)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.getStringObjectMap(MailUtils.java:321)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.sendMails(MailUtils.java:136)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.manager.EmailManager.send(EmailManager.java:39)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.plugin.EmailAlertPlugin.process(EmailAlertPlugin.java:101)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.runner.AlertSender.run(AlertSender.java:84)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.start(AlertServer.java:82)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.main(AlertServer.java:89)
dolphinscheduler-alert_1 | Caused by: com.sun.mail.smtp.SMTPSendFailedException: 451 5.7.3 STARTTLS is required to send mail [BJXPR01CA006.CHNPR01.prod.partner.outlook.cn]
dolphinscheduler-alert_1 |
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2358)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1823)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300)
dolphinscheduler-alert_1 | at javax.mail.Transport.send0(Transport.java:255)
dolphinscheduler-alert_1 | at javax.mail.Transport.send(Transport.java:124)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
dolphinscheduler-alert_1 | ... 8 common frames omitted
```
按照提示开启 tls `MAIL_SMTP_STARTTLS_ENABLE=true` 还是失败
失败原因:
```
dolphinscheduler-alert_1 | org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.partner.outlook.cn:25
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.send(Email.java:1496)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.getStringObjectMap(MailUtils.java:321)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.utils.MailUtils.sendMails(MailUtils.java:136)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.manager.EmailManager.send(EmailManager.java:39)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.plugin.EmailAlertPlugin.process(EmailAlertPlugin.java:101)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.runner.AlertSender.run(AlertSender.java:84)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.start(AlertServer.java:82)
dolphinscheduler-alert_1 | at org.apache.dolphinscheduler.alert.AlertServer.main(AlertServer.java:89)
dolphinscheduler-alert_1 | Caused by: javax.mail.MessagingException: Could not convert socket to TLS
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2155)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:752)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:388)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:246)
dolphinscheduler-alert_1 | at javax.mail.Service.connect(Service.java:195)
dolphinscheduler-alert_1 | at javax.mail.Transport.send0(Transport.java:254)
dolphinscheduler-alert_1 | at javax.mail.Transport.send(Transport.java:124)
dolphinscheduler-alert_1 | at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
dolphinscheduler-alert_1 | ... 8 common frames omitted
dolphinscheduler-alert_1 | Caused by: java.io.IOException: Server is not trusted: smtp.partner.outlook.cn
dolphinscheduler-alert_1 | at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:638)
dolphinscheduler-alert_1 | at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:553)
dolphinscheduler-alert_1 | at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2150)
dolphinscheduler-alert_1 | ... 15 common frames omitted
```
然后换了个思路测试,用相同的 python 代码以上配置,发现可以发送成功,也就是说邮件服务那边设置是没问题的?
下面为 python 代码(不会 java,不好意思)
```
#!/usr/bin/python3
import os
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
from email.mime.image import MIMEImage
def main():
# 1. 连接邮箱服务器
# 配置 1,正常发送
# con = smtplib.SMTP('smtp.partner.outlook.cn', 587)
# con.starttls()
# from_email = "no-reply@xxxx.com"
# from_email_pwd = 'xxxx'
# 配置 2,正常发送
con = smtplib.SMTP('smtp.163.com', 25)
con.starttls()
from_email = "1479xxxx009@163.com"
from_email_pwd = 'xxxxx'
con.login(from_email, from_email_pwd)
msg = MIMEMultipart()
subject = Header('找回密码', 'utf-8').encode()
msg['Subject'] = subject
msg['From'] = from_email
msg['To'] = 'xxxx@163.com'
text = MIMEText('忘记密码需要找回密码', 'plain', 'utf-8')
msg.attach(text)
con.sendmail(from_email, 'xxxx@163.com', msg.as_string())
con.quit()
if __name__ == '__main__':
main()
```
**Which version of DolphinScheduler:**
-版本:1.3.6
**Additional context**
env:
kubuntu 21.04 lts
docker
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #5661: [Question] Question title
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661#issuecomment-863724213
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] qxiong522 commented on issue #5661: [Question] email alert using stmp.partnaer.outlook.cn failed to send, help!!!
Posted by GitBox <gi...@apache.org>.
qxiong522 commented on issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661#issuecomment-863819566
> modify profile
>
> MAIL_PROTOCOL=SMTP
> MAIL_SERVER_HOST=smtp.163.com
> MAIL_SERVER_PORT=25
> MAIL_SENDER=[147xxxx009@163.com](mailto:147xxxx009@163.com)
> MAIL_USER=[147xxxx009@163.com](mailto:147xxxx009@163.com)
> MAIL_PASSWD=xxxxxx
> MAIL_SMTP_STARTTLS_ENABLE=true
> MAIL_SMTP_SSL_ENABLE=false
> MAIL_SMTP_SSL_TRUST=smtp.163.com
It's ok, Thank!!!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] cxin-william commented on issue #5661: [Question] email alert using stmp.partnaer.outlook.cn failed to send, help!!!
Posted by GitBox <gi...@apache.org>.
cxin-william commented on issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661#issuecomment-920529981
mail.protocol=SMTP
mail.server.host=smtp.exmail.qq.com
mail.server.port=25
mail.sender=xxx@yyy.com
mail.user=xxx@yyy.com
mail.passwd=xxx
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] xingchun-chen commented on issue #5661: [Question] email alert using stmp.partnaer.outlook.cn failed to send, help!!!
Posted by GitBox <gi...@apache.org>.
xingchun-chen commented on issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661#issuecomment-863781889
modify profile
MAIL_PROTOCOL=SMTP
MAIL_SERVER_HOST=smtp.163.com
MAIL_SERVER_PORT=25
MAIL_SENDER=147xxxx009@163.com
MAIL_USER=147xxxx009@163.com
MAIL_PASSWD=xxxxxx
MAIL_SMTP_STARTTLS_ENABLE=true
MAIL_SMTP_SSL_ENABLE=false
MAIL_SMTP_SSL_TRUST=smtp.163.com
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] qxiong522 closed issue #5661: [Question] email alert using stmp.partnaer.outlook.cn failed to send, help!!!
Posted by GitBox <gi...@apache.org>.
qxiong522 closed issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] github-actions[bot] removed a comment on issue #5661: [Question] email alert using stmp.partnaer.outlook.cn failed to send, help!!!
Posted by GitBox <gi...@apache.org>.
github-actions[bot] removed a comment on issue #5661:
URL: https://github.com/apache/dolphinscheduler/issues/5661#issuecomment-863779689
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org