Tuesday, July 20, 2010

.:: SendMail Command ::.

Sekedar buat catetan untuk mengirim email di linux dari console :

Command: # echo "Isi Email" | mail -s "Subjek Email" alamat_email@domain.tld

Contoh : #echo "Ini ibu budi" | mail -s "Email Penting" anda_benar@abc.com

Kalau mau dibikin shell script sederhana dengan fungsi yang sama, berikut scriptnya :
#!/bin/bash
# script to send simple email
# email subject
SUBJECT="SET-EMAIL-SUBJECT"
# Email To ?
EMAIL="admin@somewhere.com"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE



Semoga berguna.


0 comments:

Post a Comment