Email message cannot be sent

From ISPWiki

Jump to: navigation, search

BILLmanager sends email messages once a minute through a system MTA (if the email gateway is not set up).

Following is the cron job:

  • /1 * * * * /usr/local/ispmgr/sbin/cron.sh sbin/sendbfemails

If the email messages cannot be sent, you should first check that the above cron job has been created.

You also check that Cron and your mail server are up and running. Locate the following processes:

ps aux |grep cron
ps aux | egrep 'exim|sendmail|postfix'

If you failed to find the cause of the error, proceed to the next step:

Send a message to any user from the "User management" module in the billing system.

Verify that the billing system has formed a letter:

Enable Option SqlDebug in billmgr.conf, check billmgr.log to make sure that the message has been sent:

Sep 25 03:12:46 [ 3686:22] mysql query "insert into sendemail (id,message) values (1,'To: \"fly\" <fly@me.ispvds.com>\nFrom: \nSubject: [ID: 1] test\nContent-Type: text/  plain; charset=utf-8\n\nURL: https://my.ispsystem.com/manager/billmgr?func=desktop&startpage=clienttickets&startform=clienttickets.edit&elid=1\n\nSubject: test (ID  1)\n--------------------------------------------------------\ntest mess\n--------------------------------------------------------\nIf you\'d rather not receive future e- mails of this type from ISPsystem, please visit the link: https://my.ispsystem.com/manager/billmgr?func=unsubscribe&cmdhash=9Xkmfg7FrvtjjycrvFvN2UhRPKr9oabSXaRIm59vwKgPqg11h81eUERbhijnYFi6')" res = 0 
Sep 25 03:12:46 [ 3686:22] mysql query "select f.name, ifnull(f.linktoaccount, f.account) from support_messages2fileattach m2f left join fileattach f on f.id=m2f.fileattach where m2f.support_messages=1" res = 0 
Sep 25 03:12:46 [ 3686:22] read rows = 0 
Sep 25 03:12:46 [ 3686:22] mysql query "commit" res = 0 
Sep 25 03:12:46 [ 3686:23] INFO Request [sendnews][admin] 'out=xml&func=longtask.finish&elid=var%2Frun%2Fbillmgr%2Fsendnews%2Esendnews&status=ok' 

res = 0 means that the operation has been successfully performed.

Verify that the billing system has sent the message to the mail server:

You can verify it in /usr/local/ispmgr/var/sendbfemails.log with debug enabled (echo '9' > /usr/local/ispmgr/etc/sendbfemails.debug).

You will see something like this:

Sep 25 03:24:01 [ 0:0] NOTE Debug level = 9 
Sep 25 03:24:01 [ 4122:0] mysql query "set names utf8" res = 0 
Sep 25 03:24:01 [ 4122:0] EXTINFO Execute (/usr/sbin/sendmail -f -t) return=1 exited 

Execute (/usr/sbin/sendmail -f -t) - means that the message was sent to the MTA.

return=1 exited means that the function failed.

(In this case, make sure /usr/sbin/sendmail exists, check access privileges. Try sending the message by executing the same command from the console. It turned out that the email messages had not been sent because of failure of the mailbox from which email is to be sent. Go to BILLmanager -> "Projects" to provide a mailbox in the "Email for notifications". That mailbox must exist on the server).

If no errors occurred while sending the message to the mail server, examine the smtp server's logs:

If you run Exim - /var/log/exim4/mainlog (or /var/log/exim/mainlog on FreeBSD)

If you run Sendmail or Postfix - /var/log/maillog

In our case it will look something like this:

root@billmgrserver:~# 2012-09-25 03:33:01 1TGPdd-0001EH-MM <= root@mycompany.com U=root P=local S=893 id=m1348558381.4725.01@billmgrserver.com 
2012-09-25 03:33:01 1TGPdd-0001EH-MM ** fly@me.ispvds.com R=nonlocal: Mailing to remote domains not supported 
2012-09-25 03:33:01 1TGPdd-0001EJ-PT <= <> R=1TGPdd-0001EH-MM U=Debian-exim P=local S=1727 
2012-09-25 03:33:01 1TGPdd-0001EH-MM Completed 
2012-09-25 03:33:01 1TGPdd-0001EJ-PT ** root@mycompany.com R=nonlocal: Mailing to remote domains not supported 
2012-09-25 03:33:01 1TGPdd-0001EJ-PT Frozen (delivery error message) 

Reconfigure Exim (dpkg-reconfigure exim4-config). If you run Debian, by default Exim is installed only for local connections. The billing system will not configure the mail server.

Try sending the email message, view the log. The message has been successfully sent.

root@billmgrserver:~# 2012-09-25 03:43:01 1TGPnJ-0001WM-3o <= root@mycompany.com U=root P=local S=949 id=m1348558981.5846.01@billmgrserver.com 
2012-09-25 03:43:04 1TGPnJ-0001WM-3o => fly@me.ispvds.com R=dnslookup T=remote_smtp H=mail.me.ispvds.com [188.120.225.20] X=TLS1.0:RSA_AES_256_CBC_SHA1:32   DN="C=XX,ST=XX,L=XX,O=XX,OU=XX,CN=me.ispvds.com,EMAIL=webmaster@me.ispvds.com" 
2012-09-25 03:43:04 1TGPnJ-0001WM-3o Completed 
Was this helpful? Yes | No
Personal tools