ghi572000 Posted December 6, 2010 Share Posted December 6, 2010 Hi I have a html form page linked to a .php page for sending me and the user the data entered in to the from: Part of the code for example purposes: HTML SIDE <form method="post" action="thankyou.php"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input name="visitormail" type="text" size="25" /> <input name="button" type="submit" id="button" value="Send" /> </form> PHP SIDE SENDING <?php $visitormail = $_POST['visitormail']; $from = "From: $visitormail\r\n"; $from = "Cc: $visitormail\r\n"; mail("[email protected]", $subject, $message, $from); ?> What is happening is the incoming mail is coming in to me and to the user from "[email protected]" but from my ISP domain? After lots of searching I have come up with the answer that I should be using "PHP mail() and SMTP Authentication" ? Is this the case and if so how do I set up SMTP Authentication as I am new to php!!!!! Thanks Gary Link to comment https://forums.phpfreaks.com/topic/220848-form-sending-php/ Share on other sites More sharing options...
ManiacDan Posted December 6, 2010 Share Posted December 6, 2010 Look into the class PHPMailer, it will handle all of that for you. Also note that you set $from and then immediately overwrite it with the CC. You want the dot-equals operator (.=) for concatenating strings. -Dan Link to comment https://forums.phpfreaks.com/topic/220848-form-sending-php/#findComment-1143643 Share on other sites More sharing options...
ghi572000 Posted December 6, 2010 Author Share Posted December 6, 2010 Hey Dan, thanks it's amazing how a dot-equals operator can make all the difference! Working now fine Thanks Gary Link to comment https://forums.phpfreaks.com/topic/220848-form-sending-php/#findComment-1143649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.