| 1 | == How do I send email from my PHP-based web sites hosted at MayFirst (e.g. Drupal, Wordpress, etc.)? |
| 2 | |
| 3 | If your site sends minimal, primarily "internal" to your organization email, for example, password resets for administrators, then it may be acceptable to use PHP's built-in mechanisms for email (the mail() function). Using this default method will send via whatever the web server is configured to do locally (i.e. it runs the sendmail command under Linux). Typically this means the server will send email on it's own behalf. Note that [https://support.mayfirst.org/wiki/faq/email/add-spf-record SPF] should be configured to add the web server to your list of allowed senders. |
| 4 | |
| 5 | If, however, you have a larger audience receiving emails from your site, for example: members in CiviCRM, a forum of some sort, or other larger lists of site members, you will want to ensure proper delivery by using the [https://support.mayfirst.org/wiki/bulk-mail-relay bulk.mayfirst.org] mail relay. This recommendation applies when the web-application itself must email it's members directly. When this is not required, you should consider using [https://support.mayfirst.org/wiki/mailman_primer mailman] which is an included feature of your May First/People Link account. |
| 6 | |
| 7 | == Using bulk.mayfirst.org |
| 8 | |
| 9 | Assuming the web site must manage it's own emails, you can connect to the bulk.mayfirst.org SMTP server from PHP by using the [https://github.com/PHPMailer/PHPMailer PHPMail library], in the case you are writing your own PHP application. If you are using [https://www.drupal.org/ Drupal], you may use the [https://www.drupal.org/project/smtp SMTP] or [https://www.drupal.org/project/phpmailer PHPMail Drupal] modules, both of which integrate PHPMail. There are also several [https://wordpress.org/plugins/tags/phpmailer/ plugins for Wordpress] that may be suitable. Other CMS's are likely to include some sort of support or add-in to enable this feature, so searching for a well-supported existing solution is likely a good first step. Configuration should involve specifying the server as `bulk.mayfirst.org` with no login credentials (your server should already be 'trusted' to send email this way without any login required). |
| 10 | |
| 11 | When sending email through the bulk mailing system, ensure that spf.mayfirst.org is added to your [https://support.mayfirst.org/wiki/faq/email/add-spf-record SPF] list. The server itself need not be listed for email delivered this way (unless other applications on the server are sending email directly). |