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?
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.
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?
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).
You leave me in the dark completely.
Can you be a bit more precise as to where I must start my search?
Any ACTUAL HELP available please and not such "vague theory-talk" only?
Can you access the file via http not just ftp is it a public folder that can be read?
If that is really necessary: Yes, I can.
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.
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?
More information http://php.net/manual/en/function.file-get-contents.php
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?
Use smf's createpost api. You can see an example of this in my rss feed poster modification
Link?
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