Perforce Public Knowledge Base - Debugging Helix Swarm Email Problems
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

Debugging Helix Swarm Email Problems

« Go Back

Information

 
Problem
When Swarm emails are not being received how do I troubleshoot?
Solution
(1) Are any emails being sent?

If emails are only being sent to some users check the following matrix for when you should expect emails to be sent:

    https://www.perforce.com/perforce/doc.current/manuals/swarm/basics.notifications.html

From Swarm 2017.1 onwards you will also need to check the users personal email notofication settings:

    https://www.perforce.com/perforce/doc.current/manuals/swarm/basics.users.html#basics.users.settings

and the global email notification settings:

   https://www.perforce.com/perforce/doc.current/manuals/swarm/admin.notifications.html#admin.notifications.global

If you still expect emails to be sent then go to step (3) to check if Swarm is generating the email.

(2) Is email explicitly configured?

See the following section of the Swarm documentation:

    https://www.perforce.com/perforce/doc.current/manuals/swarm/admin.email.html

If email is not explicitly configured then Swarm uses the method specified in 'php.ini'. By default this uses 'sendmail'.

(3) Are you using restricted changelists by default?

As a super user run:
 
p4 configure show

and look for the text:
 
defaultChangeType: restricted
If you are using restricted changelists check that the intended users have at least 'list' permission to the files in the changelist. If they do not and you still want them to receive emails allow restructed changelists to unauthorized users using:

   https://www.perforce.com/perforce/doc.current/manuals/swarm/admin.security.html#admin.security.restricted_changes

(4) Increase logging

Increase logging to level '7', restart Apache and test. Is the email logged in the Swarm logs:

    https://www.perforce.com/perforce/doc.current/manuals/swarm/admin.logging.html#admin.logging.swarm

A good test is to @ mention a user in a comment. Make sure this is not your own user. An example of a log entry is:
2017-03-09T11:24:03+00:00 DEBUG (7): Email sent. Subject: [Swarm] Review @43 - My changelist description {"recipients":"[\"myuser+test@mycompany.com\",\"myuser+test2@mycompany.com\"]"}

(5) Test from the command line

Is 'sendmail' installed? Can you send an email from the command line:
echo Swarm Email Test | sendmail -f myuser@mycompany.com destinationuser@mycompany.com
echo Swarm Email Test2 | sendmail -f myuser@mycompany.com myuser+test2@mycompany.com

Note: When testing Swarm emails it's often usesful to pretend that your email address is multiple email addresses. You can do this by adding '+text' to the email address. For example: 'fred+test1@perforce.com'.

If that fails is port 25 using sendmail?   
netstat -anp | grep 25

If not using sendmail then check your MX record and try a manual telnet test. For example:

    https://www.port25.com/how-to-check-an-smtp-connection-with-a-manual-telnet-session-2/

(6) Additional logging

Try adding additional logging to ensure the email is being put together in Swarm:

Swarm - Adding email debugging to swarm logs

(7) Does php.ini contain a mistake?

Check for non standard SMTP configuration in 'php.ini':
 
/etc/php5/apache2/php.ini

(8) Prove that PHP email sending works

Try running the following code from the command line on the Swarm server (changing email addresses as neccessary):
<?php
/**
 * Perforce Swarm - Email testing code.
 *
 * @copyright   2016 Perforce Software. All rights reserved.
 * @license     Please see LICENSE.txt in top-level folder of this distribution.
 */
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Application;

define('BASE_PATH','/opt/perforce/swarm');
set_include_path(BASE_PATH);

include '/opt/perforce/swarm/library/Zend/Loader/AutoloaderFactory.php';
AutoloaderFactory::factory(
    array(
        'Zend\Loader\StandardAutoloader' => array(
            'namespaces' => array(
                'P4'     => BASE_PATH . '/library/P4',
                'Record' => BASE_PATH . '/library/Record',
                'Zend'   => BASE_PATH . '/library/Zend'
            )
        )
    )
);
// ensure strict and notice is disabled; otherwise keep the existing levels
error_reporting(error_reporting() & ~(E_STRICT|E_NOTICE));
use Zend\Mail;
$email = "test@smtp.perforce.com";
$emailName = "Test User";
$subject = "Test email using zend in swarm";
$message = "Swarm email sent from zend module in swarm";
$sender = "test@smtp.host.com";
//Prepare email
$mail = new Mail\Message();
$mail->addTo($email, $emailName);
$mail->setSubject($subject);
$mail->setBody($message);
$mail->setFrom($sender, 'Swarm Zend');
$transport = new Mail\Transport\Sendmail();
$transport->send($mail);
?>
<h1>Test email For <?php echo $emailName . " '" . $email. "' "; echo date("D M d, Y G:i a"); ?></h1>
Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255