Jump to content

[SOLVED] email error


contra10

Recommended Posts

i'm testing mail on local host

 

here is my coding that works

<?php
$headers = "From: [email protected]\r\n";
"To: $email";
"MIME-Version: 1.0\r\n";
"Content-Type: multipart/mixed;\r\n";
$body = "$username has added you as a friend";

mail("[email protected]","Friend Request",$body, $headers);
?>

here is the coding when i want to change the send to the user

<?php
$friende= "SELECT * FROM `users` WHERE `username` = '$usernamef'";
$friendgetemail = mysql_query($friende) or die(mysql_error());

while ($friendemail = mysql_fetch_assoc($friendgetemail))
{
$email = "{$friendemail['email']}";
}

$headers = "From: [email protected]\r\n";
"To: $email";
"MIME-Version: 1.0\r\n";
"Content-Type: multipart/mixed;\r\n";
$body = "$username has added you as a friend";

mail($email,"Friend Request",$body, $headers);
?>

 

the warning is

Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\wamp\www\friendrequest\index.php on line 71

 

line 71 being

mail($email,"Friend Request",$body, $headers);

how do i echo the person's email instead of writting it in

Link to comment
https://forums.phpfreaks.com/topic/146256-solved-email-error/
Share on other sites

im gettin an error for my mail form wich i cant get rid off...

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\mailing\inc\lib\htmlMimeMail.php on line 680

configured my php.ini to

[mail function]

; For Win32 only.

SMTP = localhost

smtp_port = 25

 

; For Win32 only.

;sendmail_from = [email protected]

 

even removed ; from php_smtp.dll file....

stil the same error....

Link to comment
https://forums.phpfreaks.com/topic/146256-solved-email-error/#findComment-767836
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.