|
Posted by Chuck Anderson on 06/13/05 23:43
Manuel Lemos wrote:
>Hello,
>
>on 06/12/2005 08:22 AM Hanjo Grüßner said the following:
>
>
>>I want to use an eMail as a trigger to start a program.
>>
>>E.g. an eMail-Group: any group-member sends an eMail to a
>>group-e-adress an the Mail is dispatches automatically to all members.
>>
>>I know there are services like yahougroups who do exactly this, but I
>>wonder wether it's possible to do something like this by my own.
>>
>>Further purposes could be to trigger any program on a webserver by a
>>special trigger-eMail.
>>
>>
>
>That is easy. I do that all the time. Basically you need to assign a
>certain address to a mailbox reachable by POP3. Then you keep polling
>the mailbox periodically until a new message reaches there to be
>redistributed to your mailing list.
>
>You may want to use this POP3 class for fetching your messages.
>
>http://www.phpclasses.org/pop3class
>
Thanks for this. I've been playing with it for a couple of hours. I've
always wanted to automatically verify new users to a mail list I
created. I'm sure you know what I mean. When they sign up I send an
automated email which they must respond to (leaving the subject
intact). This is going to work great (using cron to poll).
Have you any clever method for pulling lines out of the headers array?
Using explode at the :'s will not work because of the Date line (time
contains :'s), so I do this:
(just curious to know if there is a simpler way to do it)
for ($i=0; $i<count($headers); $i++)
{
// find first colon in the header line
$breakpos = strpos($headers[$i], ':');
// header field = substring from 0th character to breakpos
$field = substr($headers[$i], 0, $breakchar);
// set field = substring from breakpos to end of string
switch ($field)
{
case 'Date':
$date = substr($headers[$i], $breakpos);
break;
case 'From':
$from = substr($headers[$i], $breakpos);
break;
case 'To':
$to = substr($headers[$i], $breakpos);
break;
case 'Subject':
$subject = substr($headers[$i], $breakpos);
break;
}
}
I'm not going to bother with the "Received" fields.
Thanks, Manuel. You have lots of class ô¿Ô¬
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
[Back to original message]
|