Jump to content

PHP mail() function


tbailey

Recommended Posts

k.

Here's a sample form:
<form action="tbaileyprocess.php" method="post">
Name: <input type="text" name="name" size="20" maxlength="20" /><br />
Email: <input type="text" name="email" size="30" maxlength="30" /><br />
Subject: <input type="text" name="subject" size="30" maxlength="30" /><br />
Text:<textarea name="text" name="text" cols="50" rows="10"></textarea><br />
<input type="submit" name="submit" value="Send" />
</form>
---------------------------------------
the FILE: tbaileyprocess.php:
---------------------------------------
<?php
@extract($_POST);
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$text = stripslashes($text);
mail('[email protected]',$subject,$text,"From: $name <$email>");
header("location:tbaileyform.php");
?>

Like I said, I'm sure that this coding is fine. But am thinking that I'm missing something in my system. Nagging in the back of my mind is how does my smtp server authenticate this mail being sent? All I have pointing to the server is the SMTP setting in php.ini

???

Thanks! :-)
Link to comment
https://forums.phpfreaks.com/topic/5445-php-mail-function/#findComment-19485
Share on other sites

The "From:" line should be terminated with a new-line character "\r\n"
[code]<php
<?php
$name = stripslashes($_POST['name']);
$email = stripslashes($_POST['email']);
$subject = stripslashes($_POST['subject']);
$text = stripslashes($_POST['text']);
$to = '[email protected]';
$headers = "From: $name <$email>\r\n";
mail($to,$subject,$text,$headers);
header("location:tbaileyform.php");
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/5445-php-mail-function/#findComment-19488
Share on other sites

Like I said.... I'm dubious placing the code on the site....

I've tried several files (some of which have been tested on other systems and work perfectly). Please....the coding IS NOT the problem. The issue is somewhere in my flow / configuration.

Is there something that should be specified in IIS that would effect this?

On the SMTP server that the mail function sends to, is there some parameters that need to be set to accept the email that originates from mail() ?

Link to comment
https://forums.phpfreaks.com/topic/5445-php-mail-function/#findComment-19491
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.