Sending mail with php
Moderator: General Moderators
Sending mail with php
Hey, I checked out the manual for php at php.net and I was able to read a little on the mail() function. I got everything configed to use proper port and the smtp server. But I could not find out on that page how to actually send mail. Could anyone give me example of what sending to variables would look like?
there are examples at http://www.php.net/manual/en/function.m ... te]Example 1. Sending mail.
mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3");[/quote]
mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3");[/quote]
I use something similar to below.
Code: Select all
<?php
// email person
$recipient = $email; // this can come from many places. For me it comes from the persons account. You can also just type in the email address as well. Adding comas between the address will allow you more. Sometimes I will have a hidden value with the email address' typed in already.
$subject = "Your subject;
$message = "Thank you for viewing my online documents for Php and Mysql. If you would like to see something up here then please ask me.";
$extra = "From: you@yourdomain";
mail ($recipient,$subject,$message,$extra);
?>