Jump to content

[SOLVED] How to send email in php


bilalaslam777

Recommended Posts

Hello Guys,it's Urgent

 

 

can anybody tell me how to send an email in php and how to integrate my code with SMTP.

 

i have this code

 

<?php

 

$to=$_POST['to'];

$subject=$_POST['subject'];

$message=$_POST['message'];

 

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $to))

{

echo "Email address is not valid. Please try again...";

}

else

{

if(mail($to,$subject,$message))

{

echo "Mail has successfully been sent to $mailto<br>";

echo "Your message was!<br>$mailmessage";

}

else

{

echo "Sorry! Mail sending failed";

}

}

?>

 

is there anything else i have to do with this.

 

Thanks in Advance

Link to comment
https://forums.phpfreaks.com/topic/169248-solved-how-to-send-email-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.