Home >Backend Development >PHP Tutorial >php email related functions
mail() function allows you to send emails.
In order for the right-click function to run properly, PHP must access the sendmail executable file in your system during compilation. If you use other mail programs, such as qmail or postfix, make sure they use appropriate wrappers for sendmail. PHP will first look for sendmail in your PATH variable, and then look for it in the following path: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It is highly recommended to have sendmail in your PATH variable. Furthermore, the user running the compiled PHP program must also have permission to execute sendmail.
Related functions:
ezmlm_hash — Calculate the hash value required for EZMLM
mail — Send email
Usage example:
<?php $Name = "Da Duder"; //senders name $email = "email@adress.com"; //senders e-mail adress $recipient = "PersonWhoGetsIt@emailadress.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail command ?>