Beta4 Posted February 8, 2013 Share Posted February 8, 2013 Hello all names Beta4, I do apologize in advance if I am posting this in the wrong area. Im still kinda a newbie Anyhow, I want to allow the user to post data such as user name, email, and description on a generic post, this is for a project not commercial use. I want it to display a confimation with the users name, email and description on what he or she posted. Then I want an email sent to their email with the same information that displays the confirmation after they hit the submit button. This is the code I have. Thanks again all! post.php is the name of the file I have given it. <html> <head> <title>Post</title> </head> <body> <h2>Post</h2> <?php $user = $_POST['user']; $email = $_POST['email']; $description = $_POST['description']; $to = $_POST['email']; $subject = 'Confirmation on your recent post at the Trading Post'; $msg = "Your name is $user and your email is $email\n" . "Your post reads: $description\n"; $header = "From: admin@mothinrelay.com"; mail($to, $subject, $msg, $header); echo 'Your post has been submitted.<br />'; echo 'Your user name is ' . $user . '<br />'; echo 'Your email is ' . $email . '<br />'; echo 'You post reads: ' . $description . '<br />'; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/ Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 Anyone out there to help me? Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411142 Share on other sites More sharing options...
Jessica Posted February 8, 2013 Share Posted February 8, 2013 You didn't state what your problem or question is. Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411145 Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 I did ... I needed help with the code... I dont get an email stating that I posted something Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411149 Share on other sites More sharing options...
Jessica Posted February 8, 2013 Share Posted February 8, 2013 What does it output? Did you check your junk mail? Are you hosting this or using a paid host? Do they have a mail server? Does mail() return true or false? A third-party library like PHPMailer might help in the long run. Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411152 Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 I am testing it with my local machine... i have xampp installed and have my documents in the htdocs... should it still work? Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411154 Share on other sites More sharing options...
Jessica Posted February 8, 2013 Share Posted February 8, 2013 (edited) Do you have a mail server installed? Did you real the manual on mail()? Did you set your sendmail_path correctly? ignore that. Windows doesn't come with a mail server AFAIK. Google is your friend: http://books.google....windows&f=false Edited February 8, 2013 by Jessica Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411156 Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 What if im using windows 7 64-bit edition? Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411159 Share on other sites More sharing options...
Jessica Posted February 8, 2013 Share Posted February 8, 2013 Oh well that changes everything. Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411164 Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 So how would i change that if my php.ini looks like this: [mail function] ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury ; SMTP = localhost ; smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = postmaster@localhost ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly. ; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path. ; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder) ;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe" Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411166 Share on other sites More sharing options...
Beta4 Posted February 8, 2013 Author Share Posted February 8, 2013 Anyone care to help? I just dont want to do something that will mess it up, cause if you mess with the php.ini - i have had an experience before where you mess it up, it wont work properly even if you change back to what it was. Any takers? Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411180 Share on other sites More sharing options...
Technocrat Posted February 9, 2013 Share Posted February 9, 2013 My suggestion would be to set it up to use like gmail See: http://stackoverflow.com/questions/4948687/xampp-sendmail-using-gmail-account That's the easiest option. I would also use a library like swiftmailer as its much easier to use http://swiftmailer.org/ Or like Jessica suggested phpMailer Quote Link to comment https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/#findComment-1411194 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.