Skip to content

Posting by Email Feature

Spuds edited this page Oct 26, 2019 · 4 revisions

[SETUP](Setup Home) > POSTING BY EMAIL

Posting by Email

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

Features

Using email your users will be able to:

  • Start new topics
  • Reply to topics / messages
  • Reply to Personal Messages
  • Send attachments
  • Subscribe to boards and get the full text of the posts on that board
  • Get an Improved Daily Digest format
  • Automatically adds member signatures to outbound messages
  • Updates the users time online and who's online status when they post by email
  • Formats messages received so they don't look like folded email messages (within some limitations)
  • Attempts to properly quote inbound email messages (also within some limitations)
  • Uses markdown style language for both inbound and outbound messages

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.

Safe Guards

  • Emails are sent with a key to prevent email spoofing which will help keep this secure. Received emails must have a key and that key must have been sent to that user
  • Respects user moderation settings and board access / posting settings
  • Check messages headers for spam filter tags
  • Keys are only active for a single reply
  • Keys can have a defined expiration time limit, after xx days the key will automatically be removed from the database
  • New topic emails are less secure and should be enabled with caution

Admin Controls

  • All Emails which fail to post are logged, the admin, and moderators with privileges, can see the log where they can approve (if possible), delete, view or send a bounce message back to the user
  • Interface to add in parsers to define original message clip points (to remove the original message that is often sent in the reply)
  • Interface to add in filters to define strings that should be removed e.g. sent from my xyz phone
  • Interface to specify email address which define how the system will send email.

Setting up the Feature

After enabling this feature you will need to configure your server to "pipe" email replies to the emailpost.php (for replies to messages) and emailtopic.php for new topics. If your host does not allow for you to do this, see the IMAP section. Piping is the best method as it happens in real time, once a message arrives, it's processed.

  • 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.

Setting up the Feature w/IMAP

If you are reading this, then your host does not provide a way to pipe an email to a script. The alternative is to have instead the system access an email "inbox" and gather new emails that have arrived since the last check. For this to work your system needs to have php installed with IMAP functionality enabled. If you don't have IMAP and you can't pipe (forward) an email to a script, its time to consider other hosting options if you want this feature on your forum.

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.

Settings Example

An example may help in understanding some of the settings and what they do.

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 emailpost@yourdomain.com). => buzz@coffeebuzz.com
Help email address => help@coffeebuzz.com
The email address used for password reminders, notifications, etc (like noreply@yourdomain.com). => noreply@coffeebuzz.com
Email "signature" => Thanks, the Buzz Team
Receiving email addresses => cappuccino@coffeebuzz.com => Cappuccino

Using the above settings, the outbound email headers will look similar to:

- Header - - Description -
To: some-member@someplace.com 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" noreply@coffeebuzz.com The poster of the message on the forum, done as the posters "display name" followed by noreply@coffeebuzz.com
Return-Path: buzz@coffeebuzz.com 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: coffeebuzz@coffeebuzz.com 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: <help@coffeebuzz.com> (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: 676eb3668c255202d95115910e4baa30-m1295@coffeebuzz.com Message id which has our key-for details

Starting New Topics

If you enable the starting of new topic via email, you are strongly encouraged to set the Require approval option under the general receiving section. This will place all new topics, which pass other security checks, in to the moderation approval area of the board so they can be reviewed before final posting. Starting new topics is inherently less secure than replying to topics so caution is advised to prevent spamming.

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 espresso@coffeebuzz.com, latte@coffeebuzz.com, cappuccino@coffeebuzz.com. 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 cappuccino@coffeebuzz.com to the Cappuccino board.

Clone this wiki locally