[?] how to send mail in php?

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
Code:
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
For more info, see here.
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
You can also use the following code..
$to="someone@someweb.com;
$subject="Put in your subject here";
$message="Put your message here";
$header="From: sender@sender.com";

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


this is similar to the above except that some header variable are removed.
 

rima123

New Member
Messages
9
Reaction score
0
Points
0
best script for secured as well as basic mail....

<html>
<body><?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "someone@example.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?></body>
</html>
 

messa

New Member
Messages
12
Reaction score
0
Points
0
You can use this to test if your site is capable of sending mail

<?
mail("emailadres@privoder.com","test","Ok, it works");
?>
 
Top