phpfaq Posted June 23, 2007 Share Posted June 23, 2007 i am sending a mail using a php mail() function. But reciept is not able to see , who sent the mail , ie the correct from address is not coming in the mail, instead some other address related to IP Address is coming. Please anybody can suggest the solution. Link to comment https://forums.phpfreaks.com/topic/56823-from-address-is-not-coming-in-the-mail/ Share on other sites More sharing options...
Full-Demon Posted June 23, 2007 Share Posted June 23, 2007 Dont use mail() but use phpmailer or swiftmailer to send your mails. Much better performance FD Link to comment https://forums.phpfreaks.com/topic/56823-from-address-is-not-coming-in-the-mail/#findComment-280747 Share on other sites More sharing options...
mmarif4u Posted June 23, 2007 Share Posted June 23, 2007 U can use php() function. but i think there is some thing wrong in ur code. Please post ur code that we can help u. Link to comment https://forums.phpfreaks.com/topic/56823-from-address-is-not-coming-in-the-mail/#findComment-280752 Share on other sites More sharing options...
phpfaq Posted June 25, 2007 Author Share Posted June 25, 2007 U can use php() function. but i think there is some thing wrong in ur code. Please post ur code that we can help u. This is the html file <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <script language ="javascript"> function ValidationForm() { if(document.frmsendmail.txtSub.value=="") { alert("Enter the subject line!"); document.frmsendmail.txtSub.focus(); } else { frmsendmail.submit(); } } </script> </head> <body> <form name="frmsendmail" method="post" action="cgi-bin/mailerdownload1.php" onSubmit="return ValidationForm()"> <table width="100%" border="0"> <tr> <td width="33%" align="right" class="text">To : <td width="67%"><input name="txtEmailto" type="text" class="input" id="txtEmailto22" size="30" maxlength="100"> </tr> <tr> <td align="right" class="text">From : <td><input name="txtEmailfrm" type="text" class="input" id="txtEmailfrm22" size="30" maxlength="100"> </tr> <tr> <td align="right" class="text">Subject : <td><input name="txtSub" type="text" class="input" id="txtSub22" size="30" maxlength="100"> </tr> <tr> <td align="right" class="text">Mesage(body) : <td><textarea name="txtMsg" cols="50" rows="10" class="input" id="textarea"></textarea> </tr> <tr> <td align="right"><input name="hidSubmit" type="hidden" id="hidSubmit" value="true"> <input name="Submit" type="submit" class="input" value="Send"> <td><input name="Submit2" type="reset" class="input" value="Reset"> </tr> </table> </form> </body> </html> This is the php file <?php //Check whether the submission is made if(isset($hidSubmit)){ //Declarate the necessary variables $mail_to=$txtEmailto; $mail_from=$txtEmailfrm; $mail_sub=$txtSub; $mail_mesg=$txtMsg; //Check for success/failure of delivery if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from/r/nReply-to:$mail_from")) echo "<span class='textred'>E-mail has been sent successfully from $mail_from to $mail_to</span>"; else echo "<span class='textred'>Failed to send the E-mail from $mail_sub to $mail_to</span>"; } ?> Can you please advise me Link to comment https://forums.phpfreaks.com/topic/56823-from-address-is-not-coming-in-the-mail/#findComment-281807 Share on other sites More sharing options...
suma237 Posted June 25, 2007 Share Posted June 25, 2007 hey, <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Try to apply the above code Link to comment https://forums.phpfreaks.com/topic/56823-from-address-is-not-coming-in-the-mail/#findComment-281818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.