English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi;
I have Unix server and i have tried the following code to send an email:
==>
ini_set('error_reporting', E_ALL);
ini_set ("SMTP","193.188.87.163");
ini_set ("sendmail_path", "/usr/sbin/sendmail -t -i");
$Msg= "

Name " .
$_REQUEST['Yname'] .
"
Email" .
$_REQUEST['Email'] .
"
The message is " .
$_REQUEST['body'] . "
";
$FMail = $_$_REQUEST ['Email'] ;
$TMail = "alaa@cmc-amman.gov.jo" ;
$MSub = "CMC-Web Mail" ;
$fromname= $_REQUEST['Yname'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $fromname <$FMail>" ;
if (mail ($TMail ,$MSub, $Msg,$headers))
echo "Your mail have been sent";
else
echo "Sorry, your mail cant be sent";
?>
==>
the code is successful on localhost but failed when i uploaded it to the server ==> why?

2007-03-18 00:11:05 · 4 answers · asked by alaa_alomari 1 in Computers & Internet Programming & Design

4 answers

$FMail is null because you're setting it improperly.

$FMail = $_$_REQUEST ['Email'] ;

should be

$FMail = $_REQUEST ['Email'] ;

The code executes fine because there's no PHP error with it in the technical sense. However, you include a bad header with your FROM field, which is probably gumming up the works and filling up your badmail folder.

2007-03-18 03:39:22 · answer #1 · answered by Anonymous · 0 0

Have you checked your error log? It may already tell you exactly why.

Here are a few possibilities.

Is your local machine a Windows system? The mail function in Windows will use the SMTP setting. On Unix it doesn't. On Unix it looks for sendmail.

Try eliminating the ini_set command for the sendmail_path. Usually a successful Unix installation PHP already knows where to find sendmail.

You can also eliminate the ini_set for SMTP since the Unix version ignores it.

Your HTML string in $Msg should start with and end with .

For HTML email you may need a To header, and it should not use the "name " format. Try using just the email address in both the To and From headers. They are interpreted differently in Unix compared to Windows.

I hope this helps.

2007-03-18 00:56:06 · answer #2 · answered by Anonymous · 0 0

No. The recipient will evaluate the mail to be unsolicited mail if it meets the factors for unsolicited mail -- if this is commercial, unrequested, demanding, etc. Your question may be in keeping with considered one of countless distinctive confusions. Hypertext Preprocessor mail scripts are primary to deliver unsolicited mail, in keeping with risk that's what you're questioning of.

2016-10-18 23:47:55 · answer #3 · answered by fanelle 4 · 0 0

Verify the IP address of SMTP server. If not working, then please provide some more details like what error occured!

2007-03-18 00:55:57 · answer #4 · answered by Atif Majid 3 · 0 0

fedest.com, questions and answers