Jump to content

Mail()


JayLewis

Recommended Posts

Very simple register script... when i submit it when registering the account is created...

 

But no email is sent the the member... why?

 

thanks!

 

 

<?
$user="xxx";
$pass="xxx";
$database="xxx";

mysql_connect(localhost,$user,$pass);
@mysql_select_db($database) or die( "Unable to select database");

$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];

$query = "INSERT INTO members VALUES ('','$username','$password','$email')";
mysql_query($query);

$to = "$email";
$subject = 'Thank You';
$from = '[email protected]';
$message = 'Your username is: $username<br>
Your Password is: $password';

if(mail($to, $subject, $message, "From: $from"))
  echo "You were sent an email confirming your credentials.<br><br>";
else
  echo "Mail send failure - message not sent";


mysql_close();
?>

Link to comment
https://forums.phpfreaks.com/topic/44554-mail/
Share on other sites

A little reviewing of the actual function page may serve  you good. Try the -f portion.

 

http://us2.php.net/manual/en/function.mail.php

 

Example 1050. Sending mail with extra headers.

The addition of basic headers, telling the MUA the From and Reply-To addresses:
<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
   'Reply-To: [email protected]' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 

Example 1051. Sending mail with an additional command line parameter.

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.
<?php
mail('[email protected]', 'the subject', 'the message', null,
   '[email protected]');
?> 

 

Link to comment
https://forums.phpfreaks.com/topic/44554-mail/#findComment-216408
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.