Gmail As The SMTP Service

This page is deprecated.

Wikidot software sends email on various occasions: when people create new accounts, recover lost passwords, invite their friends etc.

When a local SMTP (or Sendmail) service cannot be used, an external SMTP could work. It is sufficient to edit the GlobalProperties.php. The code below will instruct Wikidot to use smtp.gmail.com as a default email service:

GlobalProperties.php:

<?php
/* this block defines how to connect to the SMTP server */
public static $DEFAULT_SMTP_HOST='smtp.gmail.com';
public static $DEFAULT_SMTP_PORT=465;
public static $DEFAULT_SMTP_USER='your-user@gmail.com';
public static $DEFAULT_SMTP_PASSWORD='your-password';
public static $DEFAULT_SMTP_SECURE='ssl';
public static $DEFAULT_SMTP_AUTH = true;
 
/* this block defines headers in the email */
public static $DEFAULT_SMTP_HOSTNAME='smtp.gmail.com';
public static $DEFAULT_SMTP_FROM_EMAIL="your-user@gmail.com";
public static $DEFAULT_SMTP_FROM_NAME="Your Wikidot Bot";
public static $DEFAULT_SMTP_REPLY_TO="your-user@gmail.com";
public static $DEFAULT_SMTP_SENDER="your-user@gmail.com";
?>

If you are using Google Applications for Domains (e.g. you have wikis in *.example.com domain and example.com is also handled by Google) you have even more flexibility:

<?php
/* this block defines how to connect to the SMTP server */
public static $DEFAULT_SMTP_HOST='smtp.gmail.com';
public static $DEFAULT_SMTP_PORT=465;
public static $DEFAULT_SMTP_USER='your-user@example.com';
public static $DEFAULT_SMTP_PASSWORD='your-password';
public static $DEFAULT_SMTP_SECURE='ssl';
public static $DEFAULT_SMTP_AUTH = true;
 
/* this block defines headers in the email */
public static $DEFAULT_SMTP_HOSTNAME='smtp.example.com';
public static $DEFAULT_SMTP_FROM_EMAIL="automailer@example.com";
public static $DEFAULT_SMTP_FROM_NAME="Wikidot Mailer";
public static $DEFAULT_SMTP_REPLY_TO="no-reply@example.com";
public static $DEFAULT_SMTP_SENDER="automailer@example.com";
?>

The two above configurations use SSL to connect to Google servers and should work without any tweaks. Just adjust user name(s), password and domain.

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License