Receiving email only on new items

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Receiving email only on new items

Post by devboy »

Hi,

I am logged in with 2 users to our mantis site. User B creates creates and assigns an issue to my user (administrator type). My user receives email.
Then for an existing issue user B adds a note. My user does not receive an email.

According to our dev team this functionality does work for them.

Furthermore, enabled email logging to investigate. Issue #86 below is an existing issue which I've added multiple notes to. As can be seen from log, it would appear mantis IS trying to send a mail. Issue #87 is a new one, for which I did receive an email.

Code: Select all

2010-10-12 12:25 IST mail_recipient Issue = #86, add Reporter = @U8
2010-10-12 12:25 IST mail_recipient Issue = #86, add Handler = @U4
2010-10-12 12:25 IST mail_recipient Issue = #86, add Note Author = @U8
2010-10-12 12:25 IST mail_recipient Issue = #86, drop @U8 (own)
2010-10-12 12:25 IST mail Issue = #86, Type = bugnote, Msg = 'email_notification_title_for_action_bugnote_submitted', User = @U4, Email = 'ira@mydomain.com'.
2010-10-12 12:27 IST mail_recipient Issue = #87, add Reporter = @U8
2010-10-12 12:27 IST mail_recipient Issue = #87, add Handler = @U4
2010-10-12 12:27 IST mail_recipient Issue = #87, drop @U8 (own)
2010-10-12 12:27 IST mail Issue = #87, Type = new, Msg = 'email_notification_title_for_action_bug_submitted', User = @U4, Email = 'ira@mydomain.com'. 
The email address was changed to mydomain.com for privacy but it was correct in both cases. Also, I made sure these emails are not in my gmail junk/spam folders nor in my outlook junk folder.

Perhaps there is a limit on email somewhere? But the above implies mantis did in fact attempt to send. Is that correct?
What do I do next?
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Receiving email only on new items

Post by atrol »

Check contents of database table mantis_email_table.
If there were no problems sending email, the table should be empty.
Please use Search before posting and read the Manual
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

I have multiple records in mantis_email_table. If I understand correctly mails the 'were' sent will not have records there?
If that is the case where can I find the send errors related to these emails?

Cheers,
DB
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Receiving email only on new items

Post by atrol »

devboy wrote:If I understand correctly mails the 'were' sent will not have records there?
All emails are inserted into the table and removed if the sending throws no error
devboy wrote: If that is the case where can I find the send errors related to these emails?
maybe log-file of your email server
Please use Search before posting and read the Manual
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

Hi,

What is the logic of sending emails... does system try and send only once or multiple times?
I am not very familiar with php. The config for send method is currently the default which is:

Code: Select all

$g_phpMailer_method		= PHPMAILER_METHOD_MAIL;
Also in config I see

Code: Select all

$g_email_send_using_cronjob = OFF;
Do I need to set the cron job myself? If so what should it call exactly?
Another thing I read in config is:

Code: Select all

If no cronjob is used, then user will have to wait for emails to be sent after performing an action
Does this mean any notification trigger would process entire table or just the email related to that event?
Lastly, since the machine my mantis is running on is at siteground, and as far as I can see I haven't got full access and unless you pay for support it's close to non-existent, I'm thinking of just changing email to SMTP and send via our gmail account. I saw the relevant configs related to this. Any thoughts on the matter?

Cheers,
DB
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

Update:

I set up cron to call /home/xxx/public_html/mantis/scripts/send_emails.php

Initially it returned an error as if coming from web instead of CLI. Just for the test I remarked lines in send_emails.php that make the check.
The cron job is reporting back to my email:

Code: Select all

/usr/sbin/sendmail: unexpected response 501 to RCPT TO command
/usr/sbin/sendmail: unexpected response 503 to DATA command
I have no idea if this is the error when trying to send the mail, or is it and error generated by php related to execution of email_send_all(); from within send_emails.php
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Receiving email only on new items

Post by atrol »

devboy wrote: What is the logic of sending emails... does system try and send only once or multiple times?
Multiple times, because every time when sending email all entries of the email table are sent
devboy wrote: Does this mean any notification trigger would process entire table or just the email related to that event?
see above: the entire table

Advantage: If you have a temporary problem with sending email, no emails will get lost
Disadvantage: If there is always a problem sending email (for example to some users with invalid email address) the email table will grow and grow and sending emails will become slower and slower

If you didn't remove your admin directory you can start the following script when logged in to see what is in email table
<yourMantis>/admin/email_queue.php
Please use Search before posting and read the Manual
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

The errors I think are unrelated to addresses, because all of us are getting emails at one point or another.
I have a feeling that it is somehow related to the contents of specific messages.
Will showing the actual data in the emails table here be of any assistance?

Also, still can't figure out what /usr/sbin/sendmail: unexpected response 501 to RCPT TO command means.
Any ideas?
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Receiving email only on new items

Post by atrol »

devboy wrote: Will showing the actual data in the emails table here be of any assistance?
Could lead in a direction
You should post also some more details about the environment you use (OS, PHP, Webserver, Database)
devboy wrote: Also, still can't figure out what /usr/sbin/sendmail: unexpected response 501 to RCPT TO command means.
I am no specialist for this, I searched the web and found similiar problems with other products. Some seemed to be caused by encoding problems with UTF-8, some by email names
Please use Search before posting and read the Manual
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

atrol wrote:You should post also some more details about the environment you use (OS, PHP, Webserver, Database)
We are set up on SiteGround on some shared server so I am not sure regarding everything.
OS is some sort of linux - not sure what distro exactly or how to check.
php version is 5.2.9
MySQL "select version()" run via phpMyAdmin outputted 5.0.91mm-log.

To test possible problems with email server, I put the following configs in config_inc.php that should have caused mantis to start using gmail as an smtp server.

Code: Select all

        $g_smtp_host = 'smtp.gmail.com:465';
	$g_smtp_connection_mode = 'ssl';
	$g_smtp_port = 465;
	$g_smtp_username = 'mantis@ourdomain.com';
	$g_smtp_password = 'userpass';
	$g_email_send_using_cronjob = ON;
1. Do you see any problems with above config?
2. Immediately after making the change I made some tests and found that still email are being partially sent. I tried to see the header data on one of these emails but was unsure whether it actually got mailed via gmail or siteground. I couldn't be sure of where it got sent from. Currently I am not getting emails at all which leads me to believe something is not working at all with above config.
3. issue 2 also leads me to the question... do config changes require restart to the apache or whatever serving this mantis installation?
devboy
Posts: 16
Joined: 19 Sep 2010, 08:19

Re: Receiving email only on new items

Post by devboy »

Update.

Issue has been resolved.
As suspected, it had nothing to do with Mantis and was an email server issue. The problem was that the mantis was using the default local account to send mail. As soon as I defined an email account and switched to SMTP (on localhost) all the stuck emails were released.

Regardless, I would suggest as a feature, the option to get detailed logs from phpmailer. I assume it must have the option to log its transactions.

Thanks for the help atrol!
Post Reply