sendmail_pre.sh

Version 1.55

Feature
Finished

All emails generated by DirectAdmin (eg: Message System notices, etc) are pushed through: /usr/sbin/sendmail This custom hook: /usr/local/directadmin/scripts/custom/sendmail_pre.sh which can be created if you need it, will allow you to override the sendmail call and handle the message yourself. For example if you want to use a remote smtp-server directly, for all DA messages, you could setup some sort of wrapper in the sendmail_pre.sh to deliver them to some port 25. -------------------- RETURN CODES If the script exists, the return code will determine how DA will handle the following actions: 0 - if exit 0 is used, it's assumed the sendmail_pre.sh has accepted the message, and there are no errors. Sendmail will not be called. You can also use this to no have DA do anything, even if the script does nothing. 1 - For exit code 1, DA assumes there was an error, and the called DA function will return with an error code (caller depends on what message is shown, etc) 2 - Exit code 2 will mean the script intends for DA to ignore that the script was there at all, and continue normally to a sendmail delivery. --------------------- ENVIRONMENT variables full_message = all headers and message contents message = just the body of the message to = the "To:" header. Could be normal email, or utf-8 nencoded email if utf8_encode_from_to=1 is set in directadmin.conf. subject = the "Subject:" header. Could be utf-8 encoded if utf8_encode_subject=1 is set in directadmin.conf. OPTIONAL (possibly not be passed) from = the "From:" header. Could be normal email, or utf-8 encoded email if utf8_encode_from_to=1 is set in directadmin.conf. reply_to = the "From:" header. Could be normal email, or utf-8 encoded email if utf8_encode_from_to=1 is set in directadmin.conf. headers = url-encoded string of possible extra headers, eg: "MIME-Version=1.0&Content-Type=text/html" (for the <html> as start of body case,, for example.

Interested to try DirectAdmin? Get a 30-day Free Trial!