Quick Search:
 PHP Code: Use SendMail Jump to:  
Category: >> PHP Code >> Use SendMail  

<< lastnext >>

Snippet Name: Use SendMail

Description: Talking to the mail program is like writing to a file. (Perl programmers will be familiar with this technique). Instead of opening a file, the (popen() function specifies a program to pipe (communicate in a standard Unix way) your message to. This makes a connection to the mail program. The puts() function is used to "print" the message headers and message body out to the mail program, connected through the file descriptor already opened with the popen() function. Because you may want to use a different mail program than sendmail, it's a good idea to store this path in variable. You can store the recipient address in a variable to make it easy to change. Here is a simple script to send a message by talking directly to the sendmail program.

Also see:
» Send iCal Email Meeting Requests using...
» Is email deliverable?
» Email attachments with PHP mail()
» Email with attachments class
» Heavy-duty SendMail function
» Automatically process email
» Live validation of email address
» Fake email addresses
» Validate email address #3
» Validate email address #2
» Validate email address one

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

$fd = POPEN("/usr/sbin/sendmail -t","w");
   FPUTS($fd, "To: [email protected] ");
   FPUTS($fd, "From: Me ");
   FPUTS($fd, "Subject: Test message from my web site ");
   FPUTS($fd, "X-Mailer: PHP3 ");
   FPUTS($fd, "Testing. ");

   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org