Mailer Setup Guide

Mailer Setup Guide

This tutorial describes steps needed to setup SJS mailer. A working email is an absolutely essential feature of the job board. In about 15 minutes maximum our guide should help you to setup the job board so that it connects to a SMTP server for reliable email delivery service. There are several major email hosting providers. Today we will describe and setup SJS to work with Gmail.

 

1. Create and configure a Gmail account

a) Open Gmail Sign Up page and create new account or use an existing one.

b) In the second step we need to enable a connection of less secure apps. Sign into the account and after open the following LINK. Make sure this option is turned on. We need to enable third party apps (the job board) to connect and use this email account as a transfer agent.

 

2. Connect the job board to the Gmail’s SMTP

a) Open Admin -> Settings -> Mailer. Enable SMTP and use the following SMTP connection details:

Host name: smtp.gmail.com

Port: 465

Connection prefix: ssl

Username: your Gmail account username

Password: your Gmail account password


Setup has been completed. Open the job board and try to subscribe for job alerts with some other email address of yours. If you receive an email the Mailer setup has been successful. If not, follow our section down below to see how to find out why the emails are not being sent.

 

Gmail sending limits

Google limits the amount of mail a user can send. This limit restricts the number of messages sent per day to 99 emails and the restriction is automatically removed within 24 hours after the limit was reached. To remove the limit and send more emails users need to sign up for a paid SMTP plan or use a different provider.

 

Branded domain emails

Users who prefer to use a custom domain name such as “[email protected]” instead of a Gmail one can either sign up for business emails with Google, or use other provider services. Zoho Mail offers a free single domain email hosting. When setting up branded mailboxes the process usually involves a domain verification and adding DNS entries into your domain registrar control panel. This tutorial does not cover the complete setup, for detail steps please refer to documentation of your email hosting provider.

 

Email testing and debugging

Follow the steps below to find out an exact reason while email setup is not working. Proceed with code changes by using your cPanel file manager or an FTP account as we need to access the SJS files.

a) first turn on the debug mode. Open “_config/config.envs.php” and change the following lines:

‘ini_error_reporting’ => 1,
‘ini_display_errors’ => ‘On’,

b) Make sure you completed the SMTP configuration from the steps above. Open “index.php” and after the libraries are loaded enter the following code (after pasting it, replace the quotes – “” as they have a different encoding):

$DEBUG_EMAIL = “[email protected]”;
$transporter = Swift_SmtpTransport::newInstance($settings[“mailer_smtp_host”], $settings[“mailer_smtp_port”], $settings[“mailer_smtp_secure_connection_prefix”])
->setUsername($settings[“mailer_smtp_username”])
->setPassword($settings[“mailer_smtp_password”]);

$mailer = Swift_Mailer::newInstance($transporter);

$message = Swift_Message::newInstance(“Email debugging”)
->setFrom(array(ADMIN_EMAIL))
->setTo($DEBUG_EMAIL)
->setContentType(“text/html”)
->setBody(“Example debug text body”);

$result = $mailer->send($message);
var_dump($result); die();

Replace the orange email address with your testing email address and after reload your job board homepage. What has been done is that we are simply sending 1 email with the current SJS SMTP settings and displaying the result. If the Mailer works there will be a “bool(1)” message, indicating that setup was successful. Otherwise there will be an error message that will point to the direction on how to solve the issue. Usual problems why emails do not work include the following:

a) account credentials or SMTP connection details are incorrect. Double check all the fields.

b) in the email account external access is disabled (e.g. Gmail / Less secure apps option). Try to enable and allow external connections.

c) hosting provider is blocking the SMTP port. Few users had a technical problem where the SMTP connection could not been established at all because the hosting company setup a restrictive Firewall rules. If you see any message that SMTP is timed out, connecting or cannot be reached – try to create a support ticket and ask your host what SMTP port / settings you should use to make sure emails will work with the application. Gmail and other SMTP providers usually offer multiple ports and connection options.


By following these steps users will be able to find out and resolve any problem related to the emails not being sent.

 

Changing the email templates

All the email texts and styles can be changed from within the Admin -> Translation -> Edit translations section. We recommend to copy the whole email template content into external editor, edit it and after copy it back. There is a way to test all of the email templates at once. To do this, follow the steps below:

a) Open “index.php” and uncomment the line:

//require_once ‘_tools/email_debug.php’;

b) open “_tools/email_debug.php” and add your testing email address

c) reload the job board homepage. You will receive all job board emails at once. This way you can test out if you make any changes.

Download Simplejobscript HERE