Tags
PHP , email , SMTP
Asked 7 years ago
25 Aug 2017
Views 2188
jaggy

jaggy posted

how to send mail in PHP ?

how to send email in PHP ?

i am using smtp for making it faster delivery to my registered user

so its true that by SMTP mail is reached so fast. or normal mail function is good
Phpworker

Phpworker
answered Nov 30 '-1 00:00

mail function is used to send Email in PHP


mail($to,$subject,$message,$header);


mail function have following argument
1. $to , email address where mail sent to
2. $subject , email subject
3. $message , email message body
4. $header , mail header (optional)

$headers = 'From: support@example.com' . "\r\n" .
'Reply-To: support@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject="Contact Us from eXample.com  ";
$message="Name ::  ".$_REQUEST['name']." \n";
$message.="Email :: ".$_REQUEST['email']." \n";
 $message.="Message :: ".$_REQUEST['message']."\n";
$admin_email="dilip.bakotiya@gmail.com";
 
if(mail($admin_email,$subject,$message,$headers)){
	$mailsent=1; 
}
Post Answer