Script the following sql command in order to check if your system is correctly configured to send out email.
Please replace party_from /party_to (624) with an existing, suitable user_id.
select acs_mail_nt__post_request ( 624, -- party_from 624, -- party_to 'f', -- expand_group 'Test Subject', -- subject 'Test Body', -- message 0 -- max_retries );
Alternatively you can use the ]po[ Developer Shell and execute the following function:
acs_mail_lite::send \ -send_immediately \ -to_addr recipient@test.com \ -from_addr sender@test.com \ -subject "Test Subject" \ -body "Test Body"
When 'send_immediately' is not set, the mail should remain in table 'acs_mail_queue_outgoing' until a Mail Sweeper passes it on to a local MTA or a SMTP server.
projop=# select * from acs_mail_queue_outgoing; message_id | envelope_from | envelope_to ------------+---------------------------------+--------------------------------- 562538 | ben.bigboss@project-open.com | ben.bigboss@project-open.com (1 row)
If an email remains in the table for a long time without being sent, check your mail log for error messages.
On most Linux systems the log file can be found at /var/log/maillog
]po[ V4.x saw some changes to file /packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl and /packages/acs-mail/tcl/acs-mail-procs.tcl
Make sure you are using the most recent version.
Its rather unlikely that email is not being send due to issues with the schedulers. However, find below additional information.
For sending emails ]po[ is using services provided by two separate packages:
Linux based ]po[ distributions you'll find quite likely 'postfix' installed. To check if postfix is running, open a shell and execute:
ps waux | grep postfix
You should see among other output the following line (path might differ):
/usr/libexec/postfix/master
Check the status of the postfix server by either running
/etc/init.d/postfix status
or
systemctl status postfix.service
...which should return something like:
master (pid 1469) is running...
or:
... Aug 29 07:29:55 project-open-v50 systemd[1]: Starting Postfix Mail Transport Agent... Aug 29 07:31:15 project-open-v50 postfix/postfix-script[1540]: starting the Postfix mail system Aug 29 07:31:16 project-open-v50 postfix/master[1543]: daemon started -- version 2.10.1, configuration /etc/postfix Aug 29 07:31:16 project-open-v50 systemd[1]: Started Postfix Mail Transport Agent.
Run
mailq -v
If there are still mail messages pending, this command should show you why. For example, you might see something like "Deferred: Connection refused by <some SMTP server>"
[Tx to Terrance Crow]
Feb 21 14:03:11 localhost postfix/smtp[4669]: 9F8F3B80B1: host mx01.schlund.de[212.227.15.186] said: 421 invalid sender domain 'project-open-v34.localdomain' (misconfigured dns?) (in reply to RCPT TO command)are fixed by setting the following parameters in your /etc/postfix/main.cf:
myhostname = your-company.com mydomain = your-company.com
Have a look at the log file (default location on most linux systems: /var/log/maillog)
In case mail is only send out to "external" recipients, but not to local recipients, check the MX record of your local DNS server.
[ref]
Some ISP (and everyday more) do exhaustive validation checks before accepting email. In some case providers check for a valid bounce address.
In OpenACS package acs-mail-lite builds random system email addresses to manage bounces instead of real addresses. Validation checks performed by ISP's would fail returning the following error message;
Feb 14 10:25:30 localhost postfix/local[14071]: CD99CB8078: to=, relay=local, delay=0.48, delays=0.34/0.08/0/0.06, dsn=5.1.1, status=bounced (unknown user: "bounce-31300-a61ed9ca5c39b63ddf28c3862041d042bd73450a-21457")
or
550-Requested action not taken: mailbox unavailable 550 invalid DNS A/AAAA resource record (in reply to MAIL FROM command)
The easiest way to fix this, is patching /packages/acs-mail-lite/tcl/bounce-procs.tcl be so that "bounce_address" it simply return a valid email address.
#--------------------------------------- ad_proc -public bounce_address { -user_id:required -package_id:required -message_id:required } { Composes a bounce address @option user_id user_id of the mail recipient @option package_id package_id of the mail sending package (needed to call package-specific code to deal with bounces) @option message_id message-id of the mail @return bounce address } { return "info@your-company.com" # return "[bounce_prefix]-$user_id-[ns_sha1 $message_id]-$package_id@[address_domain]" }
(Thanks to Frank Diekhoff, Pentamino GmbH for pointing this out)
/var/log/maillog contains 550 error:
NOQUEUE: reject: RCPT from localhost.localdomain[127.0.0.1]: 550 5.1.1 xx@my-domain.com: Recipient address rejected: User unknown in local recipient table; from=info@my-domain.com to=xx> proto=ESMTP helo=localhost /localhost/xxinfo@my-domain.com xx@my-domain.com
To turn off unknown local recipient rejects by the SMTP server, consider specifying in /etc/postfix/main.cf:
local_recipient_maps =
This setting is not recommended if your ]po[ server accepts incoming emails. For additional information pls. refer to the postfix documentation
If sending fails, there's a chance that the system does not write any error messages to the log files. To visualize the feedback received from the SMTP server, please open a ]po[ Developer Shell and execute the code below. Set values for SMTP server, recipient, etc. accordingly:
set text {some text with 8 special characters äöü ÄÖÜ ß €} set tok [mime::initialize -canonical text/plain -param {charset "utf-8"} -encoding 8bit -string [encoding convertto utf-8 $text]] set erg [smtp::sendmessage $tok \ -servers my.smtp-server.com \ -recipients recipient@test.com \ -usetls 1 \ -username mail_user_1 \ -password 123456 \ -header [ list Subject [mime::word_encode utf-8 quoted-printable $text]] \ -header [list From me@test.com] \ -header [list To recipient@test.com] ]The following error is an indicator that your SMTP service provider requires tls mail encryption: An error such as:
Please see:
Calle Aprestadora 19, 12o-2a
08902 Hospitalet de Llobregat (Barcelona)
Spain
Tel Europe: +34 609 953 751
Tel US: +1 415 200 2465
Mail: info@project-open.com