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? Quote Link to comment 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( "blablabla@gmail.com", "Comment from website", $name, $message, $email ); ?> Quote Link to comment 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( "blablabla@gmail.com", "Comment from website", $msg ); ?> Quote Link to comment 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? Quote Link to comment 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("blablabla@gmail.com", "Comment from website", $message, "From:" . $email); // $email being the variable which stores the post data. Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.