This shows you the differences between two versions of the page.
sendmail [2011/12/29 14:26] k2patel [How to change outbound IP] |
sendmail [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Sendmail ====== | ||
- | ==== How to create .cf file from .mc ==== | ||
- | It is always best practice to build .cf file from .mc | ||
- | <code bash> | ||
- | m4 sendmail.mc > /etc/sendmail.cf | ||
- | </code> | ||
- | |||
- | ==== Rebuild aliases ==== | ||
- | when you modify /etc/mail/aliases.\\ | ||
- | Possibly you see following message. \\ | ||
- | //**alias database /etc/mail/aliases.db out of date**// \\ | ||
- | |||
- | Simply run following and will fix it. | ||
- | |||
- | <code bash> | ||
- | newaliases | ||
- | </code> | ||
- | OR\\ | ||
- | run 'make' in /etc/mail to update all databases\\ | ||
- | OR | ||
- | <code bash> | ||
- | sendmail -bi | ||
- | </code> | ||
- | |||
- | ==== Error Code 126 ==== | ||
- | Following messages you see in log and mail. | ||
- | * DSN: unknown mailer error 126 | ||
- | * stat=unknown mailer error 126 | ||
- | * runscript.sh: Permission denied | ||
- | * 554 5.3.0 unknown mailer error 126 | ||
- | |||
- | It is because script you call to catch email OR execute when received has permission issue. \\ | ||
- | Simply set permission on that script to "Sendmail Default User" could be 'daemon' or 'mailnull'. \\ | ||
- | the names i have used those are i came across till now. so chances are there you see something diff. \\ | ||
- | |||
- | Whole path need to be executable by that user. | ||
- | |||
- | ==== How to change outbound IP ==== | ||
- | to change outgoing IP on your sendmail server.\\ | ||
- | change following variable. | ||
- | |||
- | <code bash | sendmail.cf> | ||
- | O ClientPortOptions=Family=inet, Address=192.168.1.22 | ||
- | </code> | ||
- | |||
- | NOTE : change 192.168.1.22 with your IP. | ||
- | |||
- | |||
- | ==== Clear queue ==== | ||
- | |||
- | Check if you want to delete all mail. | ||
- | <code bash> | ||
- | mailq | ||
- | OR | ||
- | sendmail -bp | ||
- | </code> | ||
- | |||
- | Now if you want to delete everything in queue just delete everything inside mqueue folder.\\ | ||
- | In CentOS it is located at **/var/spool/mqueue/** | ||
- | <code bash> | ||
- | rm -rf /var/spool/mqueue/* | ||
- | </code> | ||
- | |||
- | If there is too many files to remove you better use option like xargs with find. | ||
- | <code bash> | ||
- | find /var/spool/mqueue -name * -print0 |xargs -0 -r -n100 rm | ||
- | </code> |