b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Advanced Topics
  3. Blogging by email
  4. How to post by email

How to post by email

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.

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.

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.

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?).

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.

Created by fplanque • Last edit by fplanque on 2018-11-21 01:09 • •

25 comments

Comment from: Mark

Mark

How do I get it to change the blog it’s posting to? Currently it’s trying to post to blog 2.

I’ve changed (in _advanced.php) the default_to_blog setting to point to blog 5, but it doesn’t seem to change anything.

Thanks,

Mark

2004-11-26 @ 20:02

Comment from: gillesklein

gillesklein

TRADUCTION DE CETTE PAGE EN FRANCAIS

b2evo User Manual

Manual :: How to… ::
Page: How to post by email English (EU)

Cette page se réfère à la version 0.8.6 de B2evouliton

Vous pouvez mettre à jour votre site par email !

En premier, éditer le fichier /conf/_advanced.php, et renseigner les informations concernant votre compte émail (attention cette interface ne supporte par les imap pour l’instant, utiliser uniquement POP3).

Une fois que vous aurez éditer ces option, il faut que votre server exécute /htsrv/getmail.php à intervalle régulier. (le temps de rafraîchissement dépend des performances de votre serveur, le script peut utiliser beaucoup de ressources, donc ne le faites pas tourner toutes les minutes !).

Vous pouvez le faire aussi avec un cron, où si votre hébergeur ne support pas cette fonction, vous pouvez vous intéresser aux services de monitoring de site, et faire en sorte qu’ils checkent l’url du fichier b2mail.php

Premier conseil.

Il est recommandé de rédiger ses émail au format texte seulement (faites attention car Outlook et Outlook express utilisent par défaut les fonction "html", ce qui peut poser des problèmes), mais les émails au format html fonctionnent tout de même. Généralement.

Il est aussi recommander de ne pas utiliser une adresse publique, mais d’en créer une spécialement pour ce script. Un script peut toujours bugger. Et pourrait effacer tout vos mail. Nous ne pouvons prendre de responsabilité à ce sujet.

Assurez vous d’effacer tout les émails envoyé à votre blog contenu dans le dossier "envoyé" (sent) juste au cas où (pour éviter que quelqu’un ne trouve votre login et mot de passe dans ce dossier).

Le script effacera les émail que sont utilisés pour poster une info dans votre blog dès que votre émail sera publié. Si la publication a échoué l’émail ne sera pas effacé.

Comment poster un émail sur votre site.

L’émail devra être rédigé ainsi :

To: addresse@domain.com (vous aurez configuré cette adresse dans le fichier de configuration)
Subject: blog:Le titre de l’article (vous pouvez changer le mot clef ‘blog:’ dans le fichier de configuration)
Body:
login:password (exemple: Jack:Starwars)
Et votre texte, blah blah blah.
More blah blah.


L’objet doit commencer avec l’expression [blog:], ou n’importe quoi quel autre mot que vous aurez configurer dans e fichier de configuration (comme cela le script ne checkera pas tout vos mails).

Boby (corps du texte). La première ligne DOIT contenir le login et le mot de passe sous cette forme login:password, sinon le script ne prendra pas en compte le mail.

Terminer votre émail de 3 tirets bas ___
afin de prévenir le script de la fin de votre texte et d’éviter ainsi de publier les publicités qui accompagnent souvent les mails (yahoo, hotmail…).

Le cas spécial des mails envoyé par téléphones portables !

Certaines sociétés de téléphones portable permettent d’envoyer des mails. Mais sur ces services, vous ne pouvez pas toujours contrôler le renvoi à la ligne. Dans ce cas, paramètrez ainsi la ligne $use_phoneemail = 1 du fichier /conf/_advanced.php. Dans ce cas, utilisez la syntaxe suivant pour envoyer vos mail ;

To: adresse@domain.com
Subject: blog:le titre de votre article :::
Body:
login:password ::: Le contenu de votre mail blah blah blah.___

Attention aux ‘:::’ (or ou tout autre signe porte dans le fichier de configuration) arès le sujet et le login:password.

Certains fournisseurs de téléphones portables ne permettent pas d’utiliser la case ‘objet’. Ce sont les premiers caractères des mails qui sont utilisés pour l’objet. Dans ce cas rédiger votre mail ainsi :

To: adresse@domain.com
Body:
blog:le titre de l’article ::: login:password ::: le contenu du message, blah blah blah.___

2004-11-26 @ 20:18

Comment from: Dave Eagle

Dave Eagle

The default blog is set in the conf/_advanced.php file ($default_to_blog = 2; for example).

2005-02-21 @ 15:32

Comment from: Dave Eagle

Dave Eagle

The default blog is set in the conf/_advanced.php file ($default_to_blog = 2; for example).

2005-02-21 @ 15:52

Comment from: Ruda

Ruda

Hi!
With Mozilla, everithing is OK, but with IE 6.0, I don’t post. Why???

2005-03-20 @ 12:49

Comment from: Charles

Charles

To change the blog under which your emailed post will aggregate, you have to specify one of the categories for the blog in the body of the email. (I figured this out by diving into the b2evo core code…) Like so:

16

Use the ID # of the category - you can figure this out by clicking the "Categories" tab in the admin, then click the blog you want to post to. Mouse over one of the categories and look in the status bar of your browser - you should see some code that looks like:

http://blogs.mysite.com/admin/b2categories.php?action=Edit&cat_ID=16

The category ID is the "cat_ID" in the query string.

There may be (and probably *should*) be an easier way to do this.

2005-04-08 @ 16:07

Comment from: Charles

Charles

Looks like my category syntax got deleted. This is what you should put in the body of the email:

\16\

2005-04-08 @ 16:09

Comment from: Charles

Charles

oops, one more time:

‹category›16‹/category›

2005-04-08 @ 16:13

Comment from: Scott

Scott

For anyone interested, I wrote up a detailed description about ‘email by blogging’, as a supplement guide.

-Scott

2005-04-09 @ 09:13

Comment from: wow-gold

wow-gold

Yeah!Thanks!

2005-09-03 @ 09:52

Comment from: Pat

Pat

Does anyone how to post an email to a blog and disable the comment option?
Is there a line of code to enter into the body of the email that will do this?
I want to use a blog to receive emails but not give the option for readers to comment.

Thanks for any insights . . .

2006-01-11 @ 17:40

Comment from: Martin

Martin

I tried to run getmail.php from command line (and cron) using "php /path/to/htsrv/getmail.php" and noticed the following:

Warning: strpos(): Empty delimiter. in /var/www/http/www.domain.tld/blog/htsrv/getmail.php on line 248

The post makes it into the blog but the mail does not get deleted. Maybe because of this error notice or maybe because of another bug.

The next time getmail.php runs it does the same work on the old mail again and it appears again in the blog.

Maybe somebody can help me out with that… :-)

2006-02-01 @ 12:37

Comment from: Kelton Joyner

Kelton Joyner

I am trying to get posting by email to work. The first problem was my hosting web server wasn’t RFC1939 I found the fix for QMail & non-RFC1939 Compliant Mail Servers in modified the _class.pop2.php file. It now starts processing the email but after the raw processing gives the following error:

Login: username, Pass: password
(changed from real user ID password)

Wrong login or password.
OK.
How to I fix this problem

2006-03-17 @ 17:31

Comment from: Dave

Dave

I keep getting the following error at the end of my getmail php script.


Login:

, Pass:

Wrong login or password.

OK.


I can’t figure out where I am missing the login name and password.
It is both in my email body as the first line "loginname:password" and it is in the advanced.php file.

Any suggestions?

Dave

2006-04-05 @ 06:04

Comment from: GT-Schorsch

GT-Schorsch

Hello!
I’m using the post by email feature, too. I know you can change category by writing something like "15" (without qoutes and 15 being the category id), but I also need to change the message status from published to protected. I tried "protected", but getmail.php said "Illegal tag: status". So is it possible to change the message status by posting through posting by email? I hope you know what I mean…

Thanks for answering,
GT-Schorsch

2006-06-05 @ 00:37

Comment from: GT-Schorsch

GT-Schorsch

Hi again,

the category-tags and the wrong status-tags I used in the above message are not properly shown. I just wanted to say that for better understanding.

Bye,
GT-Schorsch

2006-06-05 @ 01:10

Comment from: Asked to login when run getmail.php from unix command line

Asked to login when run getmail.php from unix command line

Hi,
I tried to schedule getmail.php in cron, but when I run it from command line, it prints out the html that looks like the login page, and exit, no getmail logic seems to be executed. How to set it up then?
I am using 1.6alpha

Jun

2006-06-09 @ 17:42

Comment from: David

David

in order to change the status of the message to read anything but "published" you need to edit the line in the getmail.php file after..

// INSERT NEW POST INTO DB:

and change "published" to whatever you want. I suppose you could create a variable to designate this in the content of the e-mail also.

As for me, I just want to send a draft to the blog in order to post it later.

2006-06-16 @ 00:16

Comment from: jack

jack

I love B2Evolution. Thanks for the great software, but I’m getting frustrated with the e-mail version. How do I set up a cron

2006-06-19 @ 21:09

Comment from: sharon

sharon

I’m having the same problem others reported about wrong login, password. It seems this is a common issue. If someone has solved this can you post a reply?

2006-09-02 @ 06:27

Comment from: wrong login, password.

wrong login, password.

I had the wrong login, password.problem when I used outlook to send mails. When I switched to plain text format it worked.

Now the postings are visible in backoffice. But I cannot get them to the blog. Any help will be highly appreciated.

/Ish

2006-11-11 @ 10:39

Comment from: Dmytro

Dmytro

How to fix the timestamp problem? Posts are off by 4 hours. The time displays correctly everywhere except of b2evo.

2006-12-17 @ 21:47

Comment from: David

David

the login and password errors are coming from not sending a login or password wiht the e-mail. Don’t send the login or password for the pop3 account, but the login and password for the blog user.

This is sent in the first line of the e-mail with the format…
login:password

the colon between each is necessary.

2007-02-23 @ 15:49

Comment from: Jim Hood

Jim Hood

I am getting the following error msg when trying to use
the email function…

Requested Blog from T_blogs without ID!

Any suggestions?

Thank you!

2007-03-19 @ 23:02

Comment from: Brandy

Brandy

I just wanted to leave a positive comment. I know this is the right place to ask questions about errors and problems. It seems to pile up though and I wanted to let you know that I am very pleased with b2evolution as a whole and am enjoying the blog by email feature too. It takes some patience to learn what settings to use, but what doesn’t when you learn a new skill? Thank you for all your hard work.

2007-05-01 @ 16:48

On this page

  • Post by email
  • Additional information
  • Preliminary advice
  • How to post
  • Special cases for mobile phone email

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
  • Operations Reference
  • Advanced Topics
    • Using Desktop Blogging Tools
    • Using Blogging Apps
    • Blogging by email
      • How to post by email
      • Blog by email
    • Using the APIs
    • Contributing
    • Translations (i18n/l10n)
    • Monetizing
    • How to...
    • Podcasting
  • Glossary
  • Archives
Community software

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque