[英]Sender email using mailx and gmail SMTP cert
我寫了一個非常簡單的腳本來發送一些使用mailx的電子郵件。 該腳本工作正常,但我正在嘗試使用不同的發件人電子郵件地址,我已經嘗試了幾乎所有的東西,並沒有為我工作。 我覺得gmail證書在某種程度上會覆蓋我所定義的發件人。
這是代碼:
for i in ${EMAILS[@]}; do
mailx -s "Let me introduce myself" -r "Company <company@company.com>" -S replyto="company@company.com" $i <<eof
Hello World,
I'm an automate email
eof
done
每次我收到一封電子郵件時,發件人的電子郵件都是“公司mypersonalgmail@gmail.com”。
我在/ etc / postfix上的main.cf文件的末尾添加了這些行
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
最后,我用我的個人Gmail信息(登錄名+密碼)創建了/ etc / postfix / sasl_passwd文件。
任何形式的幫助將不勝感激。
謝謝!
我已經解決了這個問題。 我剛剛為我的個人電子郵件帳戶添加了一個新域名,現在我可以使用-r選項發送帶有不同域名的電子郵件。
此代碼也有效:
echo "This is the message body and contains the message" | mailx -v -n -r "x@domain.com" -s "This is the subject" -S smtp="smtp.server:port" -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth-user="user@domain.com" -S smtp-auth-password="pasword" -S ssl-verify=ignore to_email@domain.com
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.