Darwin cgi engine and sendmail

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Darwin cgi engine and sendmail

Dave Cragg
Hi good people

Does anyone have any experience of using sendmail from the Darwin cgi  
engine? (OS X 10.4.2)

If so, could you let me know how it's done? Or if you know it's not  
possible, could put me out of my misery and let me know.

Cheers
Dave
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Andre Garzia
Dave,

there was some snipet code by sivakatirswami showing that some time  
ago on the list, I'll search the list and get back to you.

Cheers
andre

On Oct 28, 2005, at 7:33 PM, Dave Cragg wrote:

> Hi good people
>
> Does anyone have any experience of using sendmail from the Darwin  
> cgi engine? (OS X 10.4.2)
>
> If so, could you let me know how it's done? Or if you know it's not  
> possible, could put me out of my misery and let me know.
>
> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Sivakatirswami
In reply to this post by Dave Cragg
Here you go Dave.. .from the application here that generates our  
Daily Hindu Press international..

This is running from a rev desktop stack in the GUI, but I'm pretty  
sure it will work from a CGI...

One  caveat there is a conf variable set for security, which limits  
the length of a single line input to sendmail to 990 chars. (google  
"sendmail 990" for this obscure bit of info)  Longer strings are auto  
broken with CRLF as far as I can tell. There are all kinds of scary  
admonitions not to change this setting (old mail client issues) hence  
my dreaful work around in the switch statement below.

Of course this assume the email is properly formatted I haven't  
included that here.. if you need it I can post that too... in the  
following "tMsg" contains a properly formatted, multi-part html/plain  
text email...



     # fix endlines to unix a
     replace numTochar(13) with numTochar (10) in tMsg

     # temp back up to hard drive
  put ($HOME &"/Desktop/temp.txt") into tPath
     put tMsg into url ("binfile:" & tPath)

     # introduce line breaks at the end of sentences into lines  
longer that 990 chars
     # and two such breaks in the case of lines longer than 1980 chars.
     # will break lines up to 2970 chars.
# Lines longer than that (very unlikely) will be broken by Sendmail  
at 990 with CRLF
# which appears as a space in the html email and a line break and  
space in the plain
# text version. This eliminates both:
     repeat for each line tLine in tMsg
         switch
         case len(tLine)<990
             put tLine & cr after tWrappedMsg
             next repeat
             break
         Case len(tLine)>1980
             set the itemdel to "."
             put round(the number of items of tLine/3) into tBreakPoint
             put cr before item (tBreakPoint+1) of tLine
             put cr before item (tBreakPoint*2) of tLine
             put tLine & cr after tWrappedMsg
             next repeat
             break
         Case len(tLine)>990
             set the itemdel to "."
             put round(the number of items of tLine/2) into tBreakPoint
             put cr before item (tBreakPoint+1) of tLine
             put tLine & cr after tWrappedMsg
             next repeat
             break
         end switch
     end repeat

     set the itemdel to "," # just in case!

     put tWrappedMsg into tMsg
     replace cr with "\n" in tMsg #probably not needed if everything  
is running from CGI...
     put tMsg into  $DailyHPIEmail

     # Do shell stuff and send mail, very simple...

     set the shellcommand to "/bin/sh"
     put "echo -e $DailyHPIEmail | sendmail -f [hidden email] " &  
(fld "to" of cd "staticText")  into tCmd

     # check on status and inform user
     put shell(tCmd)  into tResult
     if tResult is empty then
         answer "Mail was sent...." with "OK"
     else
         answer tResult with "OK"
     end if

end createFinalEmailAndSendIt

On Oct 28, 2005, at 11:33 AM, Dave Cragg wrote:

> Hi good people
>
> Does anyone have any experience of using sendmail from the Darwin  
> cgi engine? (OS X 10.4.2)
>
> If so, could you let me know how it's done? Or if you know it's not  
> possible, could put me out of my misery and let me know.
>
> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Dave Cragg
In reply to this post by Andre Garzia

On 28 Oct 2005, at 22:46, Andre Garzia wrote:

>
> there was some snipet code by sivakatirswami showing that some time  
> ago on the list, I'll search the list and get back to you.
>

Thanks. Andre. I found a snippet on the Metacard list from some time  
ago. This used "open process". Unfortunately, I couldn't get it to work.

Sivakatirswami wrote:

> Here you go Dave.. .from the application here that generates our  
> Daily Hindu Press international..
>
> This is running from a rev desktop stack in the GUI, but I'm pretty  
> sure it will work from a CGI...


Thanks for this. Very promising. I got it working from my normal  
machine (OS X 10.4.2) from both a regular stack and a cgi.

But I can't get it to run on the machine I want to use (OS X 10.3.9).  
I get this error:

  postdrop: warning: unable to look up public/pickup: No such file or  
directory

Googling for this brings up a lot of discussion about unix/postfix  
configuration issues. (Not really a place I want to go.) But no  
obvious solution so far.

If anyone has any hints, I'd love to hear.

Cheers
Dave
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Dave Cragg

On 30 Oct 2005, at 10:42, Dave Cragg wrote:

> Sivakatirswami wrote:
>
>
>> Here you go Dave.. .from the application here that generates our  
>> Daily Hindu Press international..
>>
>> This is running from a rev desktop stack in the GUI, but I'm  
>> pretty sure it will work from a CGI...
>>
>
>
> Thanks for this. Very promising. I got it working from my normal  
> machine (OS X 10.4.2) from both a regular stack and a cgi.
>
> But I can't get it to run on the machine I want to use (OS X  
> 10.3.9). I get this error:
>
>  postdrop: warning: unable to look up public/pickup: No such file  
> or directory
>

It looks like all I had to do was start postfix from the terminal on  
the 10.3.9 machine

sudo postfix check
sudo postfix start

(hint at www.macosxhints.com).
As soon as I did that, all the mail I'd tried to send previously  
suddenly arrived.

Thanks once again for the script.

Cheers
Dave
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Alex Tweedly
In reply to this post by Dave Cragg
Dave Cragg wrote:

> Thanks for this. Very promising. I got it working from my normal  
> machine (OS X 10.4.2) from both a regular stack and a cgi.
>
> But I can't get it to run on the machine I want to use (OS X 10.3.9).  
> I get this error:
>
>  postdrop: warning: unable to look up public/pickup: No such file or  
> directory
>
> Googling for this brings up a lot of discussion about unix/postfix  
> configuration issues. (Not really a place I want to go.) But no  
> obvious solution so far.
>
postfix is an email sending program - a replacement for the normal sendmail.
It is "sendmail compatible" (to some level of compatibility) - sounds
like it is either misconfigured, or somehow the machine has got both
sendmail and postfix running and they are in conflict.
(www.postfix.org)

I'd start by trying sendmail from the command line - can it send mail at
all ?
If not, fix that before doing anything from Rev.

If it can, then try a variant using the same switches as you intend to
use (may be a problem with mail lists, or multiple addresses, etc. ) and
then with the same list of addresses.

.... and about then I run out of suggestions :-(

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.361 / Virus Database: 267.12.6/151 - Release Date: 28/10/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Darwin cgi engine and sendmail

Dave Cragg

On 30 Oct 2005, at 11:13, Alex Tweedly wrote:

> Dave Cragg wrote:
>
>
>> Thanks for this. Very promising. I got it working from my normal  
>> machine (OS X 10.4.2) from both a regular stack and a cgi.
>>
>> But I can't get it to run on the machine I want to use (OS X  
>> 10.3.9).  I get this error:
>>
>>  postdrop: warning: unable to look up public/pickup: No such file  
>> or  directory
>>
>> Googling for this brings up a lot of discussion about unix/
>> postfix  configuration issues. (Not really a place I want to go.)  
>> But no  obvious solution so far.
>>
>>
> postfix is an email sending program - a replacement for the normal  
> sendmail.
> It is "sendmail compatible" (to some level of compatibility) -  
> sounds like it is either misconfigured, or somehow the machine has  
> got both sendmail and postfix running and they are in conflict.
> (www.postfix.org)
>
> I'd start by trying sendmail from the command line - can it send  
> mail at all ?
> If not, fix that before doing anything from Rev.
>
> If it can, then try a variant using the same switches as you intend  
> to use (may be a problem with mail lists, or multiple addresses,  
> etc. ) and then with the same list of addresses.
>
> .... and about then I run out of suggestions :-(

Thanks, Alex. As you probaby saw, I managed to get it working,  
applying the sophisticated method of "turning it on".

I've never paid much attention to how mail works on any computer I've  
used. I just take it for granted. On OS X, I knew that Postfix was  
installed, but had no idea how it was used, if at all, by e-mail  
applications. I still don't know.   I just hope by starting up  
postfix, I haven't created a calamity of any kind. Fingers crossed!. :-)

Cheers
Dave


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution