How to send Email using PHP with MySQL in Linux Server?..
Answer Posted / karthi
PHP Code
The PHP code to send email is simply one PHP function mail
() . The basic format for this function is:
mail("to", "subject", "message");
For example (this is straight out of the online help that
comes with PHP):
mail("joecool@example.com", "My Subject", "Line 1\nLine 2
\nLine 3");
PHP does need to be installed and setup properly for mail
to work. On a Unix-type setup, such as Linux, PHP will use
your local sendmail program to send it. Windows machines
use SMTP. If you need to you can edit your php.ini file and
set the appropiate SMTP host you use to send email.
Here's the code to send the email:
if ($REQUEST_METHOD == "POST") {
// Just to be on the safe side - I'll strip out HTML tags
// (scripting code may mess with some email clients)
$realname = strip_tags($realname);
$email = strip_tags($email);
$feedback = strip_tags($feedback);
// setup variables
$sendto = "$email";
$subject = "Send Mail Feedback Using PHP";
$message = "$realname, $email\n\n$feedback";
// send email
mail($sendto, $subject, $message);
}
?>
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What are php errors?
What are new features in php 7?
Why php 7 is faster?
What are psrs? Choose 1 and briefly describe it?
Why is node js better than php?
How to remove duplicate values from array using php?
Which database is best for php?
Is php object oriented?
What is get and post method in php?
What is a php web application?
Which function is used in php to delete a file?
What is the function in PHP do not return a timestamp?
Explain the difference between urlencode and urldecode?
What are the design patterns in php?
What is the name of scripting engine in php?