Jump to content

[SOLVED] Mail ()


goldberg

Recommended Posts

Hi I am having some problems using the mail function with a form. I am getting this error message:

 

Warning: mail() [function.mail]: SMTP server response: 501 unacceptable mail address in ...

 

 

Here is my code($msg is defined elsewhere)

 

 


$e =$_POST[email]; 

$headers="From: ".$e."\n" 
    . "Content-Type: text/plain; charset=$charset; format=flowed\n" 
    . "MIME-Version: 1.0\n" 
    . "Content-Transfer-Encoding: 8bit\n" 
    . "X-Mailer: PHP\n"; 


mail("[email protected]","funding questionare",$msg,$headers); 

 

and also I know the $e var is working because I echo it and it looks fine.

I don't kow whats wrong please help!

 

Thanks - Goldberg ???

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

what is the ...

break your mail tag into two lines

<?php

$e =$_POST['emai'l]; 

$headers="From: ".$e."\n" 
    . "Content-Type: text/plain; charset=$charset; format=flowed\n" 
    . "MIME-Version: 1.0\n" 
    . "Content-Transfer-Encoding: 8bit\n" 
    . "X-Mailer: PHP\n"; 


mail("[email protected]",
"funding questionare",$msg,$headers); 
?>

 

tell me if its the first line or second line erroring

Link to comment
https://forums.phpfreaks.com/topic/84505-solved-mail/#findComment-430551
Share on other sites

Thanks but that didn't work either. Here is what I have now

 


$e =$_POST['email'];
$headers="From: ".$e."\r\n"
    . "Content-Type: text/plain; charset=$charset; format=flowed\r\n"
    . "MIME-Version: 1.0\r\n"
    . "Content-Transfer-Encoding: 8bit\r\n"
    . "X-Mailer: PHP\r\n";


if ($short_ip != "203.144" && $short_ip != "212.138")
mail("[email protected]",

"funding questionare",$msg,$headers);

 

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