Posting by Email Feature - Mstcool/Elkarte GitHub Wiki
The mailist / post by email feature allows users of your forum to reply to the sites email notifications and have those replies post on the forum. This generates a reply key that is unique to each outbound message / recipient combination to ensure that reply posting is done securely and without risk of spoofing from other peoples accounts.
Features
Safe Guards
Admin Controls
Setup
IMAP Setup
Setup Example
New Topics
Note: The proper formatting of email is a difficult area for a wide variety of reasons. The primary problems are around the vast number of email client programs and how they format, or don't, sent email. Additional complications arise from mixed encoding within the message, caused by cut and paste, as well as improperly configured email routers. Emails, in general, get folded at 78-80 characters, a throw back to when users sat in front of a green terminal that was 80 characters wide. Un-folding that email to its original intended form is problematic, the program does what it can to make it look nice.
- In your cPanel go into Email -> Forwarding and then make the defined Return-Path email address forward to "|/home/path/to/ElkArte/emailpost.php" without the quotes. Here the path is the path to the emailpost script (Note that's a path - not a URL!) If you are not using cPanel you'll need to work with your host to set this up.
- In your cPanel go into Email -> Forwarding and then make the forum's New Topic email addresses forward to "|/home/path/to/ElkArte/emailtopic.php" without quotes. Here the path is the path to the emailtopic script (Note that's a path - not a URL!) If you are not using cPanel you'll need to work with your host to set this up.
- IMPORTANT: emailpost.php and emailtopic.php are PHP scripts that require you to have a PHP binary (cgi/cli). On most *nix systems, this binary will be found in /usr/bin/php. If your PHP binary is not in /usr/bin/php, you may need to change the first line of the scripts from #!/usr/bin/php to #!/path/to/your/php/binary
- Please note that you may also need to chmod the scripts "emailpost.php" and "emailtopic.php" to ensure they are executable.
Assuming your host does have IMAP enabled (the system will confirm this), and you have an email account that will accept IMAP requests, then you need to enable a cron job on your server to tell it to run the IMAP script on a regular schedule. If your host does not allow that then you can accomplish this with a scheduled task aka (fake-cron). The server side cron is preferred as it happens irrespective of whats occurring on your forum, where as a scheduled task will run on schedule assuming there is some activity on your site.
To configure IMAP, the system will need three things, the mailbox address, the username and password to access the mailbox. For example if you have a gmail account, you would enter your username and password for the account then enter the following {imap.gmail.com:993/ssl/novalidate-cert}INBOX This is the address and port inside of {'s followed by the folder to check for mail.
Next you schedule a job to periodically import messages into the forum. As an example here is a crontab line to load messages every 5 minutes: */5 * * * * /path/to/your/elkarte/forum/emailimap_cron.php or if you can't set up a cron job, check the Fake-Cron box and a schedule task will be enabled, you can adjust those settings from the scheduled task area.
Lets say you have a site about coffee, the long site title is "Coffee makes my head buzz buzz buzz" and the domain is www.coffeebuzz.com. You have 3 boards, Espresso, Latte and Cappuccino.
Enter the email From name for the site => Coffee Buzz
The email address that replied to messages will be sent (like [email protected]). => [email protected]
Help email address => [email protected]
The email address used for password reminders, notifications, etc (like [email protected]). => [email protected]
Email "signature" => Thanks, the Buzz Team
Receiving email addresses => [email protected] => Cappuccino
Using the above settings, the outbound email headers will look similar to:
- Header - | - Description - |
---|---|
To: [email protected] | Who the email will be sent to |
Subject: [Coffee Buzz] The Posts Subject | The Subject of the email, [site name] makes it list server like |
From: "poster via Coffee Buzz" [email protected] | The poster of the message on the forum, done as the posters "display name" followed by [email protected] |
Return-Path: [email protected] | Who the reply will go to when the receiver replies to a message. This must be the email address that you piped to the emailpost.php script |
Date: Fri, 15 Feb 2013 00/:47/:29 -0000 | The date of the message |
X-Mailer: ELKARTE | The sending mail program |
X-Auto-Response-Suppress: All | Used to stop auto responders |
Auto-Submitted: auto-generated | Also used to stop auto responders |
List-Id: [email protected] | List header to help prevent spam rejection |
List-Unsubscribe: http://www.coffeebuzz.com/index.php?action=profile;area=notification | List header to help prevent spam rejection |
List-Owner: <[email protected]> (Thanks, the Buzz Team) | List header to help prevent spam rejection |
Mime-Version: 1.0 | The email mime type |
Content-Type: multipart/alternative; boundary="ELKARTE-09bd30be448490d466af858ee502ee76" | The content-type and multipart boundary |
Content-Transfer-Encoding: 7bit | The encoding of this section |
Message-ID: [email protected] | Message id which has our key-for details |
If you allow the starting of new topics via email, you need to do the above inbound steps and also set up email addresses for each board that you will allow an email to start a topic in. In the above example you have three boards Espresso, Latte and Cappuccino and three email addresses [email protected], [email protected], [email protected]. You need to go to your Cpanel and pipe those email address to the emailtopic.php script.
Next you must set up the control lines which lets the script know where to post email for a specific address. If you have more than board in which you want to allow new topics to be started by email, you simply add a new address and board combination in the admin control panel. In this example you have email received at [email protected] to the Cappuccino board.