Powered by MediaWiki
Personal tools

Email

From b2evolution manual

Jump to: navigation, search

This manual page is outdated. NEW PAGE: How to post by email in b2evolution v5+.

Contents

[edit] Post by email

You can post news from an email client but first you'll have to edit /conf/_advanced.php, filling the appropriate values for your POP3 email account (this interface doesn't support IMAP yet, only POP3, sorry).

Once you have edited the config options, you can make your webserver execute /htsrv/getmail.php every set amount of time (depending on your host's performance, this script can be resource intensive, so don't make it run every minute or you'll be kicked).

You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your b2mail.php URL.

[edit] Additional information

In later versions, setting up post by email is done via the backoffice, though. Just insert the account information for the account used for the script. This script appears to accept IMAP.

Also, the script for this is now under /cron/getmail.php and may require a shebang (see below) as line 1 to operate via cron. Make sure that you give execute permission on user and group for this to work.

Hint 1: If a cron indicates errors in the first lines of the PHP, use #!/usr/bin/php as the shebang.

Hint 2: If you are getting "permission denied" messages, try using permission settings 0754.

Note: You may have to try different settings for permissions and the cron, depending on your host, though.

An example of a successful run of this Cron is:

X-Powered-By: PHP/5.2.9
Set-Cookie: cookieb2evosession=3422_XLX49Uwm3ouvQ4wgyQBMe45fJMTqIKus; expires=Fri, 21-Feb-2020 02:00:02 GMT;
path=/; domain=[subdomain].yourdomain.com
Content-type: text/html

[Error messages, if any, are here]

If there is nothing after this statement, the job was run successfully. It will tell you any errors as well underneath this area to show you that the job ran as scheduled.

[edit] Preliminary advice

It is strongly advised to send your email as text-only (Outlook and Outlook Express default to 'html', which may cause problems), but HTML email could work (the script would strip all your html tags though...).

It is also advised not to use your public email address, but create a new one especially for this script. If you use your public email address and the script goes crazy posting every email on your blog and deleting all your emails, I can't take responsibility for this.

Make sure you delete any email sent to your blog in your 'Sent' folder too, just in case (you don't want someone to find your login and password in the 'Sent' folder).

The script will delete the emails that were used to post stuff on your weblog if it successfully posted your stuff. If it didn't manage to post, the email is not deleted.

[edit] How to post

Now to post something, here's how your email should look:

To: address@domain.com (you set it in the config file)
Subject: blog:the post's title (you can change 'blog:' in the config file)
Body:
login:password (example: Jack:Starwars)
The content of the post, blah blah blah.
More blah blah. 

Subject must start with [blog:], or any string you set in the config file (so that the script doesn't check EVERY email in your mailbox).

Body's first line must always be login:password, else the script will just skip the email.

If you don't use [___] (or any body terminator that you set in the config file), the script will post the whole body, which is not what you want if you send email with Yahoo or Hotmail (you don't want their ads on your blog, do you?).

[edit] Special cases for mobile phone email

Some mobile phone service providers may allow you to send email with your mobile phone or PDA, but on such devices you can't always include line breaks. In such case, you have to set $use_phoneemail = 1 in /conf/_advanced.php, and then here's how you write the email:

To: address@domain.com
Subject: blog:the post's title :::
Body:
login:password ::: The content of the post, blah blah blah.___

You will have to append ':::' (or whatever string you set in the config file) after the subject, and after the login:password.

Some mobile phone service providers may not allow you to set a subject, and they'll make the subject be the first characters of the body, in which case you would send an email like this:

To: address@domain.com
Body:
blog:the post's title ::: login:password ::: The content of the post, blah blah blah.___

More discussion on this topic can be found at http://b2evolution.net/man/2004/06/16/post_by_email_howto.