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("theiblis11@gmail.com","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
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("theiblis11@gmail.com",
"funding questionare",$msg,$headers); 
?>

 

tell me if its the first line or second line erroring

Link to comment
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("theiblis11@gmail.com",

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

 

Link to comment
Share on other sites

Turns out that the space between From:  and the " was screwing the whole thing up. It's working fine now like this

 

$headers = "From:".$e."\r\n";


if  ( 1==1)
mail("hgarner@bvfr.com","funding questionare",$msg,$headers);

 

thanks for your help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.