Re: [Exim] PHP Form to send emails with Exim

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Jason Gerfen
Data:  
Para: eli-list
CC: exim-users
Asunto: Re: [Exim] PHP Form to send emails with Exim
Eli wrote:

>Jason Gerfen wrote:
>
>
>>Jason Gerfen wrote:
>>
>>
>>>Richard Welty wrote:
>>>
>>>
>>>>On Wed, 11 Feb 2004 13:28:10 -0700 Jason Gerfen
>>>><jason.gerfen@???> wrote:
>>>>
>>>>
>>>>
>>>>>sendmail_path = /usr/exim/bin/exim -t -odq
>>>>>
>>>>>
>>>>ok, you don't have to have -i but it might be a good idea.
>>>>
>>>>
>
>Yup, the arguments you need (bare minimum) are -t -i.
>
>
>
>>>>>I have also tried to make a symbolic link from the sendmail file to
>>>>>point to the exim binary with no luck. For my mail the simple php
>>>>>
>>>>>
>
>If exim doesn't work directly, it won't work with a symlink either :)
>
>
>
>>>>>code. <?php
>>>>>$to = "email@???";
>>>>>$sub = "Subject line";
>>>>>mail($to,$sub,$_POST['$msg']);
>>>>>
>>>>>
>
>This is *all you need* to send an email using PHP:
>
><?php mail('your@???', 'my subject', 'my little message', "From:
>my@???"); ?>
>
>The reason that I put everything in single quotes is so that PHP doesn't try
>to expand any of it. The last thing is not in single quotes because if you
>ever want additional headers aside from From: (note that this will NOT
>rewrite the envelope sender. The envelope sender will be the user that
>Apache runs as @the.fqdn.of.the.server), you need to add \n (actually \r\n,
>but since it's on a unix server, \r screws things up) and single quotes
>would prevent that from expanding to a newline.
>
>
>
>>>>i have always used mail() as a 4 argument function and passed the
>>>>last arg as "" unless i wanted to add headers with it. i've never
>>>>seen it work with 3 args, but then i've never tried it either.
>>>>
>>>>
>
>3 arguments are just fine. The fourth is optional and sets additional mail
>headers.
>
>
>
>>>I tried a couple of changes in my php.ini and my php code to use exim
>>>using the mail() function and this is the error I am now recieving.
>>>*Fatal error*: Call to undefined function: mail() in
>>>*/usr/local/www/htdocs/dhcp/email.php* on line *8
>>>php.ini
>>>
>>>
>
>This means you don't have an exim problem (at least not yet). You most
>definiately have a PHP *compile* problem. The mail() function is added
>automatically IF YOU HAVE SENDMAIL IN A KNOWN PATH! If you didn't have
>sendmail (the program name - it cares not what program it really is, ie exim
>or sendmail or qmail) in at *least* /usr/sbin/, then chances are it FAILED
>to add in mail() support.
>
>Or maybe I'm wrong. I don't compile PHP that often to know if this is
>right, but I *believe* there is a sendmail detection thing in the configure
>or makefile scripts that will bypass adding the mail() command if it's not
>found.
>
>Whichever it is, if you can't even do this in PHP:
>
><?php mail(); ?>
>
>Then you have problems (it *should* give you an error saying you're missing
>required arguments - NOT "call to undefined function").
>
>
>
>>>sendmail_path = /usr/exim/bin/exim -t -i
>>>
>>>and my php code...
>>>mail(test@???,subject,contents,server@???");
>>>
>>>
>
>Newp, the mail() call won't work like that - you need to enclose your
>strings in quotes (and you seem to have lazy quote hanging at the end
>there). Close though.
>
>
>
>>The OS is Slackware Linux 9.1 with Apache 2.0.38, PHP 4.0 and I am not
>>sure if it is chrooted, I don't believe it is.
>>
>>
>
>If this is a pre-compiled version, this should maybe be brought up on a
>slackware discussion list. If it's a compiled PHP that you did yourself 1)
>You should serious look at upgrading to PHP 4.3.4, and 2) this would be
>something to bring up in a PHP discussion list (or you can go on to EFNet
>(IRC) and join #php - they are very helpful there at times).
>
>Eli.
>
>
>--
>
>## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
>
>
>

K, thanks a ton... you were right however my switches work for exim on
the command line but not from php and the reason it did not is when php
was compiled sendmail was not present. Thanks a ton. I am going to
recompile and test it out after getting a sendmail binary in place.

--
Jason Gerfen

"... well, actually, I am more like a sheep in wolves clothing."
                            ~ me