Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: SMiFFER on March 14, 2018, 01:35:00 AM

Title: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on March 14, 2018, 01:35:00 AM
I would like to discuss a possible solution or workaround for the following problem:

There is a mod that allows to have an email posted to an SMF-forum:
http://custom.simplemachines.org/mods/index.php?mod=2843

I really like the idea and so I tried it, until I found out that my provider does not allow Email-Piping.

What I would like to do now is circumvent this issue. I have written a program that creates a text-file on my FTP-server
and what I need now is help to fetch this file, read its contents and post it to my forum.

The file already contains this:
subject
topicID (where to have the following posted)
text

This is how far I got.
Any help maybe?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: butch2k on March 14, 2018, 08:55:10 AM
As an admin of a forum where post by email is possible i may share some insights on the matter.

I think you might want UserID/User Email/User Name or any other way to link the reply to a user, you need to filter any spam or error message as well (think of the "user address unknown" messages you might get back).

You can add a job which check the email directory for any new file whenever the index page is displayed for instance.

Make sure the content and subject is correctly encoded as many email client base64 some of the stuff, corect UTF-8 if needed, and you need to take care of the tags as well. You do not want to insert <script> tags in the DB...

It is no small undertaking.
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on March 15, 2018, 09:43:32 PM
As said: The one and only sender is my own programme. It writes only couple lines of plain text.

Quote from: butch2k on March 14, 2018, 08:55:10 AM
You can add a job which check the email directory for any new file whenever the index page is displayed for instance.

And how is precisely this part done?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: butch2k on March 16, 2018, 05:46:42 AM
You can get inspiration by the way email is sent in SMF or else add some javascript code to index.template.php which will call a php script on your server (best to do it randombly, i.e: call the script once in 10 page openings for instance).
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on March 31, 2018, 04:08:29 AM
You leave me in the dark completely.
Can you be a bit more precise as to where I must start my search?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on April 16, 2018, 04:00:16 PM
Any ACTUAL HELP available please and not such "vague theory-talk" only?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: vbgamer45 on April 16, 2018, 04:21:03 PM
Can you access the file via http not just ftp is it a public folder that can be read?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on April 18, 2018, 09:12:07 AM
If that is really necessary: Yes, I can.
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: vbgamer45 on April 18, 2018, 09:32:43 AM
That woudl probably be the easily since then you can easily fetch the file with file_get_contents from php.
Otherwise you have to use an ftp or sftp class to connect to your ftp server and fetch which can be done but is more work.
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on April 19, 2018, 12:03:16 PM
The file in question would be transmitted using FTP and then accessed by HTTP as you said.
But how exactly do I then take the contents and create a post from it?

Can you provide an example how that can be done?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: vbgamer45 on April 19, 2018, 12:26:48 PM
More information http://php.net/manual/en/function.file-get-contents.php
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on April 19, 2018, 06:36:58 PM
Thanks,
But how exactly do I then take the contents and create a post from it?

Can you provide an example how that can be done?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: vbgamer45 on April 19, 2018, 06:37:53 PM
Use smf's createpost api. You can see an example of this in my rss feed poster modification
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: SMiFFER on April 20, 2018, 02:08:11 AM
Link?
Title: Re: Workaround when the provider does not allow Email-Piping
Post by: tinoest on April 20, 2018, 05:18:51 AM
Quote from: SMiFFER on April 20, 2018, 02:08:11 AM
Link?

Assume you can search, but if you can't... http://custom.simplemachines.org/mods/index.php?mod=624