我试图从码头集装箱发送电子邮件。我所能看到的最简单的一行是从earlier堆栈溢出响应中看到的:
docker run --rm --net="host" php:fpm-alpine sh -c 'echo "Subject: test" | sendmail -v your@mail.com'我将your@mail.com更改为gmail地址并运行命令。问题是,我现在在我的终端中得到了这个输出:
sendmail: recv:'220 mail.example.com ESMTP ready'
sendmail: send:'EHLO linuxkit-025000000001'
sendmail: recv:'250 mail.example.com'
sendmail: linuxkit-025000000001: Host not found,为了获得一个简单的示例邮件,我需要做什么不同的工作?
我想我已经接近了,因为我正在从sendmail获得输出。
发布于 2019-03-08 23:19:07
Sendmail试图通过位于这里的SMTP服务器转发您的电子邮件:mail.example.com.。这是此映像上sendmail的内置默认配置。
您要做的是传递sendmail的google SMTP配置,如下所示:
echo "Subject: test" | sendmail -v -f your@mail.com -au<your-gmail-account> -ap<your-gmail-password> -H 'openssl s_client -quiet -tls1 -connect smtp.gmail.com:465' your@mail.com以下方面的实际例子:
会像这样:
echo "Subject: test" | sendmail -v -f your@mail.com -auyour@gmail.com -ap123456 -H 'openssl s_client -quiet -tls1 -connect smtp.gmail.com:465' your@mail.comsendmail --帮助
供参考,这里是sendmail --help。您可以从正在使用的图像中获取它:
docker run --rm php:fpm-alpine sendmail --helpBusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.
Usage: sendmail [-tv] [-f SENDER] [-amLOGIN 4<user_pass.txt | -auUSER -apPASS]
[-w SECS] [-H 'PROG ARGS' | -S HOST] [RECIPIENT_EMAIL]...
Read email from stdin and send it
Standard options:
-t Read additional recipients from message body
-f SENDER For use in MAIL FROM:<sender>. Can be empty string
Default: -auUSER, or username of current UID
-o OPTIONS Various options. -oi implied, others are ignored
-i -oi synonym, implied and ignored
Busybox specific options:
-v Verbose
-w SECS Network timeout
-H 'PROG ARGS' Run connection helper. Examples:
openssl s_client -quiet -tls1 -starttls smtp -connect smtp.gmail.com:25
openssl s_client -quiet -tls1 -connect smtp.gmail.com:465
$SMTP_ANTISPAM_DELAY: seconds to wait after helper connect
-S HOST[:PORT] Server (default $SMTPHOST or 127.0.0.1)
-amLOGIN Log in using AUTH LOGIN (-amCRAM-MD5 not supported)
-auUSER Username for AUTH
-apPASS Password for AUTH
If no -a options are given, authentication is not done.
If -amLOGIN is given but no -au/-ap, user/password is read from fd #4.
Other options are silently ignored; -oi is implied.
Use makemime to create emails with attachments.https://stackoverflow.com/questions/55068797
复制相似问题