顯示具有 email 標籤的文章。 顯示所有文章
顯示具有 email 標籤的文章。 顯示所有文章

2019年8月11日 星期日

An Email Program for Sending SMTP Mail from a Command Line



An Email Program for Sending SMTP Mail from a Command Line
參考:
http://caspian.dotconf.net/menu/Software/SendEmail/


# Download
http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v156.zip
# unzip ...

#


# example
# Use Gmail
./sendEmail  \
    -f "momo2alert@csp.twm"   \
    -u "Email Subject 1"     \
    -t "cc.vbhsieh@gmail.com" \
    -s "smtp.gmail.com:587"  \
    -o tls=yes \
    -xu "username" \
    -xp "password" \
    -o message-file="/etc/hosts"



/omscripts/sendEmail/sendEmail.pl \
-f "mydb@lab.com"" \
-s smtpserver:25 \
-o message-file="$HTMLOut" \
-o message-charset=utf-8 -o message-content-type=html \
-u "[mydb] ERROR call `date -d "1 Hour ago" +%Y-%m-%d-%H`" \
-t "$MAILTO" \
-cc "$MAILCC" \
-a $LOG2 /home/mplususer/omscripts/code.txt




正常模式  多檔模式

/omscripts/sendEmail/sendEmail.pl \
-f "mydb@lab.com" \
-s smtpserver:25 \
-u "[TOP SQL]_[mydb] DB StackPack Report ${DAY_1} " \
-m "mydb DB StackPack Report ${DAY_1} " \
-t "$TPMMAIL" \
-cc "$MAILLIST" \
-a `find /oracle/u02/omscripts/SP -maxdepth 1 -name "*.txt"`


alias

TO=mike@mylab.com

alias MAIL='/omscripts/sendEmail/sendEmail.pl -f "`hostname`@send" -s smtpserver:25 -u "Mike Send real send `hostname`  `date +%Y-%m-%d_%H:%M:%S` " -m "Mike Send real send `date +%Y-%m-%d_%H:%M:%S` " -t $TO -a '





Configure A Postfix Relay Through Gmail On CentOS 7


參考:
https://devops.ionos.com/tutorials/configure-a-postfix-relay-through-gmail-on-centos-7/




yum -y install postfix cyrus-sasl-plain mailx

#systemctl restart postfix
#systemctl enable postfix



# Configure Postfix
 vi /etc/postfix/main.cf

#  必須修改
inet_interfaces = all

# 以下加入
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
---


# 修改密碼檔
vi /etc/postfix/sasl_passwd

[smtp.gmail.com]:587 username:password

---

chown root:postfix /etc/postfix/sasl_passwd*
chmod 640 /etc/postfix/sasl_passwd*

systemctl reload postfix

---

Test Relay

echo "This is a test." | mail -s "test message" cc.vbhsieh@gmail.com

---

RHEL install EPEL

  https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...