thewabbit1 Posted April 29, 2010 Share Posted April 29, 2010 Hey, im pretty new to the whole php thing. I am testing out a contact us form for a website. I have set it up for the info written in the feilds (name email address comment) to be sent to my email. But i was wondering if i could also send a conformation email to the email address that was entered in the email feild? This is the code i have tried so far, with no luck: <?php $name = $_POST ['name']; $email = $_POST ['email']; $address = $_POST['address']; $comment = $_POST['comment']; $newsletter = $_POST['newsletter']; $content = "Hey \n $name wants to get in contact with you. Their comment was: \n $comment \n $name can be contacted on $email and their address is $address. \n Newsletter: $newsletter"; $from = "From: $email"; $clientcontent = "Hey $name \n Thank you for registering your interest in *********. We will get back to you as soon as possible. \n Thank you \n \n Your inquiry \n Name: $name \n Email: $email \n Address: $address \n Comment: $comment \n Newsletter: $newsletter" ; $fromclient = "*****@*******.*******" ; mail('*****@*******.*******', 'Inquiry from SportSmart website', $content, $from) ; mail('$email', 'Inquiry from SportSmart website', $clientcontent, $fromclient) ; ?> Link to comment https://forums.phpfreaks.com/topic/200128-send-email-to-two-different-accounts/ Share on other sites More sharing options...
Ken2k7 Posted April 29, 2010 Share Posted April 29, 2010 Read the manual - mail. It says how to specify multiple recipients. Link to comment https://forums.phpfreaks.com/topic/200128-send-email-to-two-different-accounts/#findComment-1050493 Share on other sites More sharing options...
andrewgauger Posted April 30, 2010 Share Posted April 30, 2010 Here is an example on the same page: http://us2.php.net/manual/en/function.mail.php#93980 Link to comment https://forums.phpfreaks.com/topic/200128-send-email-to-two-different-accounts/#findComment-1050851 Share on other sites More sharing options...
thewabbit1 Posted April 30, 2010 Author Share Posted April 30, 2010 I found my problem I had mail('$email' I shouldve had mail($email thanks for your help tho Link to comment https://forums.phpfreaks.com/topic/200128-send-email-to-two-different-accounts/#findComment-1051264 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.