sendmail not sending subject and message body -
i using send email. email being sent doesn't have subject , message in it. have tested ${mail_subject}
, ${message}
have correct values.
echo "from: ${mail_from} \nto: ${mail_to} \nsubject: ${mail_subject} \n${message}" | /var/qmail/bin/sendmail -f ${mail_from} ${mail_to}
can let me know how can fix issue?
i'd call duplicate of https://unix.stackexchange.com/questions/168232/what-is-the-format-for-piping-a-message-into-sendmail , there seems mistake in line well.
- you may need use
-e
optionecho
, per link above. manpage:
-e enable interpretation of backslash escapes
note don't have problem on os x, , not apply bsd. doesn't hurt either.
- there needs 2 newlines between subject line , mail message. is, empty line.
thus, following may work properly:
echo -e "from: ${mail_from} \nto: ${mail_to} \nsubject:${mail_subject}"\ "\n\n${message}" | /var/qmail/bin/sendmail -f ${mail_from} ${mail_to}
Comments
Post a Comment