How do I send yahoo mail through php?

Charles

New member
I found out that Yahoo! only uses SMTP, that is great, but I don't know how to use the PHP mail function with SMTP. Below is my PHP code, it throws out it's little error with Yahoo!, how do I add the SMTP stuff to it?

if($form_complete)
{
$name= mysql_real_escape_string($_POST['name']);
$to= mysql_real_escape_string($_POST['email']);
$from= "support@$company_name.com";
$descr= mysql_real_escape_string($_POST['description']);

$headers= "From: $from \r\n";
$subject= "$company_name Customer Support!";
$msg= "Greetings,\r Thank you for contacting us," .
"a $company_name support member will respond to you within 24 hours.\n".
"\rMessage:\n" . $descr .
"\rRegards,\n$company_name";

$s_headers= "From: $to \r\n";
$s_msg= "Customer Support!\r\b $name \r\b $descr ";

if(!mail($to, $subject, $msg, $headers)) //sent to the user
$error = "unable to send mail";
mail($from, $subject, $s_msg, $s_headers); //sent to customer support
}
 
My guess is that the problem is with your SMTP configuration in php.ini, not with your code.
It might help if you post what you have changed there (minus account names and passwords, of course).

Also...why are you using mysql_real_escape_string on strings you are going to pass to an SMTP server? SMTP != SQL
 
My guess is that the problem is with your SMTP configuration in php.ini, not with your code.
It might help if you post what you have changed there (minus account names and passwords, of course).

Also...why are you using mysql_real_escape_string on strings you are going to pass to an SMTP server? SMTP != SQL
 
My guess is that the problem is with your SMTP configuration in php.ini, not with your code.
It might help if you post what you have changed there (minus account names and passwords, of course).

Also...why are you using mysql_real_escape_string on strings you are going to pass to an SMTP server? SMTP != SQL
 
Back
Top