Posting via mail: mail2wall Component?

Claus Lampert Posted in Component Development 7 years ago

I have several Wordpress-Sites where I can autopost my articles by sending an email to a special email-adress (admin only).
I know how to read an email via php and send it to an MYSQL-Database but I am not able to write a component for OSSN. Is there anyone who would like to help me or do that?
The component should do that:
- read the email (containing text and one picture as attachment, maybe a password)
- upload the picture
- post the text to the wall (or a group?)

It should be a "hidden feature" for the admin only! No need for an user interface.

Replies
German Claus Lampert Replied 7 years ago

Hopefully we'll find another exciting component here in a few days. :)
I will do my best! :-)
By the way: great idea this "fake-posting-thing", great component! When I have done the "post by mail" I will try a "post from RSS-feed" based on this "fake-posting component".

German Michael Zülsdorff Replied 7 years ago

There's a new component called Fake Postings available now showing how to generate a posting from external sources. See:
https://www.opensource-socialnetwork.org/component/view/1993

Make a copy of that component, rename it and adapt the necessary paths and code to your own component.
Remove all that random stuff from the actions and cronjobs files and replace it by your code to read a mail instead.

Hopefully we'll find another exciting component here in a few days. :)

German Claus Lampert Replied 7 years ago

@Zetman: You are right, there is no need for a component. But it would be easier to share if someone else want it.
I would prefer to do this with some lines of "OSSN-functions" inside a component (as in components/OssnWall/actions/wall/post/home.php) and not with mysql-statements on my own.
Update: So far, I am now able to post text to the wall via email. It´s nearly done...

German Michael Zülsdorff Replied 7 years ago

As I can't find even a code skeleton on Github: Is there any progress on this one?

Another question: Why do want to make it a component at all? Because to my understanding the mails need to be "translated" to postings automatically without any admin interaction. And that would mean to have a standalone script, executed by cron let's say every 15 minutes to poll your mailbox and import the mails to your community.

German Michael Zülsdorff Replied 7 years ago

Hello Claus,
this forum isn't really meant to share that large amount of code like yours. Not too seldom the editor is swallowing some special chars and in the end you won't get displayed what you wanted anyway.

I'd suggest to make a copy of a minimal component like HelloWorld or CustomStrings instead, rename it, put it onto Github, store your function in the libraries subdirectory and hope that somebody will interact and add the missing code.

German Claus Lampert Replied 7 years ago

[...] Code deleted according to admins reply

After a few hours of try and error I only need a code snippet:
- the text I want to publish is stored in, for example, $mailcontent
- the picture is uploaded to /post/photo/xxx/xxx.png

Now I only need some lines that put $mailcontent and the imagepath correctly into the database.