Author Topic: command line ในการส่งเมลแบบต่างๆ mutt sendmail  (Read 10671 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
ปกติใช้ sendmail ก็ครอบคลุมหมดครับ แต่มา mutt แล้วก็เจ๋งดี สามารถ ส่งเป็น mutiple file ได้ครับ คือ attach file หลายๆไฟล์

#echo "Subject: Welcome Message To NTT Members" | cat - /home/golf/sms_send.txt  | sendmail -F "support-mail@xxxx.co.th" -f support-mail@xxxx.co.th  $account < $USERLIST/sms_send.txt

#pkg_add -r muttjavascript:void(0);

#mutt -s "Welcome Message To xxx Members" -a sms_send1.txt  -a test.txt  unix@xxxx.co.th < $USERLIST/sms_send.txt

-s คือ subject
-a คือ attachfile
< sms_send.txt  คือ ข้อความที่จะให้แสดงใน message mail
unixwg@xxxx.co.th คือ email ปลายทางที่จะส่งไป

ถ้าต้องการแก้ from ให้มาจากใครก็ set ที่

#vi /home/user/.muttrc

set from="username@yourmail.com"
set realname = username test"


ถ้าต้องการ options เพิ่มก็ man mutt เลยครับ
« Last Edit: กุมภาพันธ์ 19, 2014, 01:39:11 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: command line ในการส่งเมลแบบต่างๆ mutt sendmail
« Reply #1 on: พฤษภาคม 16, 2013, 01:54:48 PM »
ถ้าเป็น command ง่ายก็นี่เลยครับผม

#mutt -a xxx.php -s "check send at 1706" golfreeze[at]packetlove[dot]com

โดยที่
1. xxx.php เป็นไฟล์ที่ attach ไปในเมลครับ
2. ส่วน "check send at 1706" คือ subject
3. golfreeze[at]packetlove[dot]com = email ปลายทางที่ต้องการส่งไปครับ

 ;)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: command line ในการส่งเมลแบบต่างๆ mutt sendmail
« Reply #2 on: มิถุนายน 10, 2013, 01:22:17 PM »
อีก command ที่ผมชอบใช้ส่งเมล และ แนบรายละเอียดในไฟล์ มาแสดง เป็นเนื้อเมล คือ
#mailx  account@example.com <  attach_file_name

หรือ

#mail  account@example.com <  attach_file_name

ก็แล้วแต่ชอบครับ
« Last Edit: มิถุนายน 10, 2013, 01:39:50 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: command line ในการส่งเมลแบบต่างๆ mutt sendmail
« Reply #3 on: มีนาคม 11, 2023, 02:43:59 PM »
# Send email inform admin
echo "Backup Mongod finish on ${FULLTIME}" | mail -s "Backup Mongod ${FULLTIME}  done" abe@gmail.com