View Full Version : sendmail and php
I have used sendmail with perl before, but I don't know how to use it in PHP. Perhaps someone can point me in the right direction.
Thanks!
Atomic-Design
4-28-02, 12:57 PM
Oh it's easy.
$to = "someone@domain.com";
$subject = "hi";
$message = "This is the message that's in the email";
mail ($to, $subject, $message) or print "Couldn't send mail";
Oh, so I don't need to tell it the path to sendmail, it can do it by itself? PHP is great! :)
Thanks!
Atomic-Design
4-28-02, 01:42 PM
For me, it sent it from my POP mail.
you mean your powweb mail account?
Atomic-Design
4-28-02, 02:38 PM
Ya, I didn't have to configure anything, PHP just figured it out.
Yes, it says in the docs that if you don't tell it the path to sendmail, it will find it. You can set it manually somehow too.
pieterhielema
4-29-02, 01:18 PM
Thanks a lot. I had reserved tonight to figure this out. Now I found this entry and are ready within 5 minutes...isn't live wonderfull?
Pieter
http://www.pbholland.com
You can also funk it up abit... adding a From address'n'**** :
.... using variable expansion for the message... and $to, etc, as stated in the posts above.
Want to send HTML messages? :
[php]
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
... set those variables up :
.... add $headers to the 'mail' command... and done.
... ooops.. forgot to say that in the $message, you gotta have HTML code, to send HTML.
Yes, there are several nice examples in the docs that I looked at. :) http://www.php.net/manual/en/function.mail.php
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.