kotkoda Posted June 18, 2008 Share Posted June 18, 2008 Hello, I am new to php. Hopefully it is not a difficult thing what I need. I will have a simple form with first name, last name and email address (and submit, reset) button. What I need is that the form would send a specific set text together with the fist name and last name to the specified email address. However, I think where the problem lies (or maybe not) is that the message received from the form should look like it came from the Email address of the one filled out the form. (It is a listserv that would receive the message from the form - so it has to be very exact. ) No subject needed all the message has to be in the body... Can anyone help me with this? Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/ Share on other sites More sharing options...
kotkoda Posted June 18, 2008 Author Share Posted June 18, 2008 I have another problem (different, simple form): Why this does not send back ALL the info from the form? I assume this is the problem: $name, $message, $email ); but how do I correct it? (I need the form send back name, email, message - that's all in the form itself). v<?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "[email protected]", "Comment from website", $name, $message, $email ); ?> Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-568555 Share on other sites More sharing options...
rhodesa Posted June 18, 2008 Share Posted June 18, 2008 <?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $msg = "Name: $name\nEmail: $email\nMessage: $message"; mail( "[email protected]", "Comment from website", $msg ); ?> Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-568561 Share on other sites More sharing options...
kotkoda Posted June 26, 2008 Author Share Posted June 26, 2008 Thanks a lot! Anyone has ideas about the first one. Is it possible at all? Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575306 Share on other sites More sharing options...
Wolphie Posted June 26, 2008 Share Posted June 26, 2008 From what I can make out of you're objective is that you want the user to enter their e-mail address, and you want the e-mail being sent to appear as if it came from the e-mail address they entered? Assuming this is true, you obviously have an input field for them to enter their e-mail address. From that just do something similar to: mail("[email protected]", "Comment from website", $message, "From:" . $email); // $email being the variable which stores the post data. Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575316 Share on other sites More sharing options...
dannyb785 Posted June 26, 2008 Share Posted June 26, 2008 ^ I've had issues on my server sending emails with the "From" header not corresponding to my domain. But it may work for him... Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575318 Share on other sites More sharing options...
Wolphie Posted June 26, 2008 Share Posted June 26, 2008 ^ I've had issues on my server sending emails with the "From" header not corresponding to my domain. But it may work for him... Odd, did you set the server up yourself? I've often had mail problems because of typos in the configuration files. Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575325 Share on other sites More sharing options...
dannyb785 Posted June 26, 2008 Share Posted June 26, 2008 No, I didn't. I dont think it's typos. Consistently, anytime I accidently sent as mail as if it's from another domain(gmail or whatever), it sends nothing. And the minute I change it to the right domain, it sends. weird Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575328 Share on other sites More sharing options...
rhodesa Posted June 26, 2008 Share Posted June 26, 2008 A lot of hosting services have started blocking outgoing email where the FROM header is set to an outside domain. Basically they don't want people to use their servers for phishing. Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575337 Share on other sites More sharing options...
Wolphie Posted June 26, 2008 Share Posted June 26, 2008 A lot of hosting services have started blocking outgoing email where the FROM header is set to an outside domain. Basically they don't want people to use their servers for phishing. Understandable, I suppose if I was in their position I wouldn't want it either. Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575343 Share on other sites More sharing options...
dannyb785 Posted June 26, 2008 Share Posted June 26, 2008 A lot of hosting services have started blocking outgoing email where the FROM header is set to an outside domain. Basically they don't want people to use their servers for phishing. Which is exactly what I figured was the reason. Link to comment https://forums.phpfreaks.com/topic/110805-need-some-form-help/#findComment-575348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.