[plugin] Mail2List v2.0.0b (with cron job possibilities)

3rd party code for phpList

[plugin] Mail2List v2.0.0b (with cron job possibilities)

Postby SaWey » 4:56pm, Tue 21 Aug, 2007

Hi,

I've finally created v2 of the Mail2List plug in.
This time you can use a cron job to process the plug in.

I did a lot of code optimization/sanitization,
which now gives a more proper output to the user and doesn't need any reloading of the page anymore.

I would like it if some people could help me testing the new version,
so it soon can be used in a live environment.

HOW TO:
Download the plugin HERE
<Mod Edit> Please note, this is no longer being supported by the original poster. I have updated the above link so you can now find the download.

As in the first version, you just have to copy the files to your plug in directory except for one, the 'm2l_cron.php',
this one you have to copy in your root './lists/' folder.

You configure it like you were used to do it
(See wiki)

To use the cron, you will have to add a cronjob as you do like to process your messages, but you have to point it to '/home/mydomain/public_html/lists/m2l_cron.php'

That's it.
Thanks for helping me test this.


TO DO:
change the user import function as suggested in this post:
viewtopic.php?p=35208#35208
Last edited by SaWey on 7:50am, Sun 02 Nov, 2008, edited 1 time in total.
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

contradiction in queue messages dropbox

Postby thanksdrive » 12:39am, Tue 11 Sep, 2007

hi
still trying to get this to send messages on thanksdrive dotcom but will struggle through.

however when you select queue to messages the configuration saves with result in settings overview
as "stored not queued" "yes"

maybe this contradiction could be cleared but I think I have other problems. bleeding edge is always the same.

thanks tony

Love the concept and all the work you've done.
thanksdrive
phpList newbie
 
Posts: 1
Joined: 12:31am, Tue 11 Sep, 2007

problem with the cron

Postby floppy » 3:15pm, Wed 31 Oct, 2007

Hi,

first, congratulation for your amazing job.

I have a little problem with my cron job.
I configured everything, but here is the log I received from the cron

Code: Select all
/home/mysite/public_html/mailinglist/m2l_cron.php: line 1: ?php
: No such file or directory
/home/mysite/public_html/mailinglist/m2l_cron.php: line 2: /**
: No such file or directory
/home/mysite/public_html/mailinglist/m2l_cron.php: line 3: access-logs: command not found
/home/mysite/public_html/mailinglist/m2l_cron.php: line 4: access-logs: command not found
/home/mysite/public_html/mailinglist/m2l_cron.php: line 5: syntax error near unexpected token `('
/home/mysite/public_html/mailinglist/m2l_cron.php: line 5: `    * Created by SaWey (C) 2007
'


I tried to remove the lines 1 to 5 but in this case I receive some other error message.

Any idea ?

Thanks
floppy
phpList newbie
 
Posts: 3
Joined: 3:10pm, Wed 31 Oct, 2007

Postby SaWey » 3:23pm, Wed 31 Oct, 2007

Could you please post your cron job and your m2l_cron.php
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

Postby floppy » 3:09pm, Thu 01 Nov, 2007

Hi,

I find a solution from my provider, I add
Code: Select all
/usr/bin/php
before my corn job
Code: Select all
 /home/mydomain/public_html/mailinglist/admin/index.php -pprocessqueue -c/home/mydomain/public_html/mailinglist/config/config.php >/dev/null
floppy
phpList newbie
 
Posts: 3
Joined: 3:10pm, Wed 31 Oct, 2007

Mail2List cron not working

Postby jjc » 1:00pm, Mon 24 Mar, 2008

Hey SaWey. I have been banging my head on this plugin for hours and haven't been able to get it to work. My most recent output is this:

X-Powered-By: PHP/4.4.1
Content-type: text/html

That is what I get back on my list server's default email address.

I have made many adjustments to cron files, to the m2l_cron.php, and other various files. (I realize I am not giving too much detail here, but after changing things around for 3 hours you lose track of what exactly has been done.)

I was getting the same errors that others have reported, with messages like:

/home/mysite/public_html/mailinglist/m2l_cron.php: line 1: ?php: No such file or directory
/home/mysite/public_html/mailinglist/m2l_cron.php: line 2: /**: No such file or directory

etc. I can get those to go away by specifying PHP either in the crontab line or in the m2l_cron.php file itself. Either method gets me the same result of the "X-Powered by" message I quoted above.

I tried copying over the files from the m2l_cron archive, because I had installed the other mail2list archive first. That didn't change anything.

I just can't get this darn thing to move my emails around automatically. I can still process the emails by logging into PHPList Admin and picking Process Emails from the mail2list plugin screen. But this doesn't do me too much good unless it can be automated.

Thanks,
Justin
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Postby SaWey » 2:16am, Tue 25 Mar, 2008

Hi,

When you browse to the m2l_cron.php url with your browser, what do you get then?
don't forget to try with a fresh install of the plugin.
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

Pointing browser at path...

Postby jjc » 3:54am, Tue 25 Mar, 2008

I get a blank web page.

I pointed my browser at:
http://www.santiamwine.com/phplist/m2l_cron.php

(That is the actual domain if you want to see for yourself.)

I grabbed the HTTP headers for the request and reply. The reply header has the "X-Powered-By" lines in it that I was getting back in my log files. I highlighted those lines in bold below.

Here they are:
http://www.santiamwine.com/phplist/m2l_cron.php

GET /phplist/m2l_cron.php HTTP/1.1
Host: www.santiamwine.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: logintheme=; cprelogin=no; cpsession=closed; webmailsession=closed; langedit=; lang=; webmailrelogin=yes; PHPSESSID=1a463ea3aa3040a43cb51891177b807b

HTTP/1.x 200 OK
Date: Tue, 25 Mar 2008 03:38:27 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.1 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.1
Content-Type: text/html

Transfer-Encoding: chunked
Connection: close

After deleting the cookies from my browser for that domain:
http://www.santiamwine.com/phplist/m2l_cron.php

GET /phplist/m2l_cron.php HTTP/1.1
Host: www.santiamwine.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

HTTP/1.x 200 OK
Date: Tue, 25 Mar 2008 03:42:32 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.1 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.1
Content-Type: text/html

Transfer-Encoding: chunked
Connection: close
Age: 0


I thought that I had done a fresh install but will try it again. Is there going to be an issue with the other files that come in the m2l_cron archive vs. the ones that are in the mail2list archive? I know there are differences in the files, but will that possibly affect the functioning of the two parts (mail2list and m2l_cron)? I did copy over the get_email.class.php from the m2l_cron archive to the server, but I don't think that I moved the other files. (I had installed the mail2list archives first and then found the m2l_cron files, so my first attempts with the cron I had just copied the m2l_cron file to my server, and not all of the archive's files.)

Thanks!
Justin
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Postby SaWey » 5:21am, Tue 25 Mar, 2008

The versions are almost compatible, best to stick with one. I don't have a lot of time ATM, but if you don't here from me in a couple of days, feel free to pm me or post a reply, so I'm reminded :)
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

A few questions upon reinstalling...

Postby jjc » 12:44pm, Tue 25 Mar, 2008

So I went through and deleted all the files on the web server for mail2list and m2l_cron.php. I then copied the files from the m2l_cron archive back to the server in their various locations. I walked through the documented configuration steps...

When editing the paths to the attachments directories, what is the second path relative to? Does it just point to the same directory as referenced in the URL, but starting from the domain user's root directory?

Thanks for the quick replies. I hope I can work this out.

-- JC

PS. After reinstalling and going back in to set up the lists, I noticed that - of course - the database entries were still in there from my previous configuration. I would assume that this wouldn't affect anything, but I suppose that there might be a difference in the tables that could cause a problem between the two versions? I did resave the configuration items under the newer files. (Just to be clear, the files from m2l_cron archive are the ones I am assuming are newer and those are the ones I am using now, after removing everything else).
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Still not working

Postby jjc » 1:22pm, Tue 25 Mar, 2008

I am still getting the same blurb back when calling the file:

X-Powered-By: PHP/4.4.1
Content-type: text/html


This is after I changed the m2l_Cron.php file to include this line:

#!/usr/bin/php

Otherwise, I would get the file not found messages mentioned in previous posts.

:(

-- JC
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Different errors...

Postby jjc » 7:15am, Wed 26 Mar, 2008

It struck me that this might be a case of running PHP in CLI mode vs CGI mode. So I modified the m2l_cron.php file to make it run in CLI mode (I modified the first line of the file from

#!/usr/bin/php

to

#!/usr/local/bin/php

This then gave me some different errors that I am still trying to work around (by setting up the config path a little more explicitly).

Can you clarify if this script needs to run in CLI or CGI mode?

Thanks again,
Justin
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Still trying...

Postby jjc » 2:47am, Tue 01 Apr, 2008

I haven't heard back from you, or anyone else, yet, so I will send you a PM with some deeper details in it.


-- Justin
jjc
PL Nut
 
Posts: 29
Joined: 8:17am, Mon 17 Mar, 2008

Postby SaWey » 11:20am, Tue 01 Apr, 2008

jjc wrote:SaWey,
I am still not able to get the m2l_cron.php to work. I have tried many different things without any luck. I posted a few additional questions in the forum thread a number of days ago. If you could address some of those, or if you have any suggestions, I would greatly appreciate the time.

I realize that there are other things in the world to occupy our time, though. :)

As a refresher for my current problems, the mail2list.php portions of the plugin seem to work OK; I am able to process emails if I click the "Process New Mails" button on the plugin page. It is just getting the cron part to successfully execute and trigger the main script. As asked in the forum thread, does it matter which style of PHP is being used (e.g. CLI, CGI, HTTP)? I do get slightly different responses when changing the style used, but nothing successful. How critical are the paths in the m2l_cron.php file? They were originally all relative paths, I have tried absolute paths and changing the PLUGIN_ROOTDIR path in config.php. I tried setting the cron job up as via CURL instead of as a shell script or PHP file, and I get something different from that:

This is the Cron line that I am using (yes, it is a bit long and has two commands on it - I wanted a bit of extra logging):
Code: Select all
echo "Starting cron job for m2l_cron.php via curl ---" >>/home/domain/tmp/logs/m2l_cron.log; curl -s "http://www.domain.com/phplist/m2l_cron.php"

And this is the response:
Code: Select all
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file


I tried to put the m2l_cron.php file itself in here, but even the CODE quoting method messed it up, especially at the start which is where the important stuff is. So I am going to try and attach it to this PM. (It wasn't clear if it attached the file the first time, so I tried again with a Zipped version of the file. There still doesn't seem to be a positive indicator that the file is attached...)

Are there things that need to live in certain accessible areas, like in the public_html directory? Are there accessibility considerations? I have added the m2l_cron.php the the .htaccess file in all the directories where I think that it might need access.

If you feel like you have to time and it might help, I don't mind giving the login information so you could poke around directly. Again, I realize that isn't what you necessarily want to spend your time on.

Thanks again for the help you are providing. I have been thinking that I need to pick up PHP myself, but I haven't taken the time to do it yet, and trying to get this project up and running for someone else's timeline doesn't help. :)


-- Justin

PS. One small issue/bug that is bothering me, too: if I process an email with an attachment, the message that gets sent out has the attachment on it but it is slightly renamed, and has a number at the front of the file name. So my original message might have "An_Attachment.PDF", but the message that goes to the list will have "34An_attachment.PDF" on it. I haven't taken the time to try and dig out the section of code that is dealing with the attachments and file names.


Hi,

I didn't get the attachment, but here's some ideas:

Have you added the path of php to m2l_cron.php?
you should have something like
Code: Select all
#!/usr/bin/php -q
<?php

at the top of that file.

What happens when you visit http://www.example.com/phplist/m2l_cron.php with your browser?

If you can't figure it out, I'm willing to take a look myself, but you should set up a phplist-test account/list where I can do some stuff on.

About the attachments, at line 700 of get_email.class.php, you can remove "$this->newid.", so you won't have the number.
I don't remember why I added this :)

I'm also posting this pm on the forums (sensored), so everybody can benefit from it.
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

Postby Guest » 8:36pm, Mon 27 Oct, 2008

i just installed this plugin and i am trying to use it to make it easier to process HTML messages but soon as i try to send out an html message it send the messagfe to the recipients with nothing in it but the following picture as an attachment.

:?:
Guest
 

Next

Return to Contributions: Plug-ins, Add-ons, Mods

Who is online

Users browsing this forum: No registered users and 1 guest