cgm225 Posted April 8, 2008 Share Posted April 8, 2008 I have a LAMP on which I have my personal website/domain (let's say example.com). Right now I have a contact form/script on my site that sends messages (including the users e-mail, subject, and message) via the mail() function to my school e-mail address. I use the form so I don't have to post my actual e-mail address on my site (to prevent spam, etc). So the flow of mail is as such: website contact form/script with mail() --> my actual school address However, when I do this, I then receive mail from [email protected], NOT from the user's e-mail address. My question:: Is there a way to send mail with the PHP mail() function but be "from" the e-mail address of the user (not the generic server address). Thank you all in advance! Link to comment https://forums.phpfreaks.com/topic/100176-php-mail-function-and-forwarding/ Share on other sites More sharing options...
we4freelance Posted April 8, 2008 Share Posted April 8, 2008 Hello, Please add From field in header parameter of function as shown below. <?php mail("[email protected]", "the subject", "message", "From: [email protected]"); ?> Hope this will help you. Thanks. Link to comment https://forums.phpfreaks.com/topic/100176-php-mail-function-and-forwarding/#findComment-512191 Share on other sites More sharing options...
cgm225 Posted April 8, 2008 Author Share Posted April 8, 2008 perfect, thank you! Link to comment https://forums.phpfreaks.com/topic/100176-php-mail-function-and-forwarding/#findComment-512226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.