Jump to content

Needin help with Email confirmation


Beta4

Recommended Posts

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: [email protected]";

 

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>

Link to comment
https://forums.phpfreaks.com/topic/274231-needin-help-with-email-confirmation/
Share on other sites

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

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"

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.