/    Sign up×
Community /Pin to ProfileBookmark

An automatic email reply to sender from php Form

im using some code to submit a form information to my email address, but as the submit buttin is pressed i want to send an automatic email to the email address supplied in the form to let them know ‘we’ll be in touch soon’, what do i need to add/edit to the below code to achieve this??

[code=php]//Your SMTP servers details

$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = “localhost”; // specify main and backup server or localhost
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = “[email protected]”; // SMTP username
$mail->Password = “*****”; // SMTP password
//It should be same as that of the SMTP user

$redirect_url = “http://”.$_SERVER[‘SERVER_NAME’]; //Redirect URL after submit the form

$mail->From = $mail->frogdigi; //Default From email same as smtp user
$mail->FromName = $_POST[‘fullname’];

$mail->AddAddress(“[email protected]”, “Frog Digital”); //Email address where you wish to receive/collect those emails.

$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML

$mail->Subject = $_POST[‘service’];

$message = “<b>Name: </b>”.$_POST[‘fullname’].” rn <br><br><b>Email: </b>”.$_POST[’email’].” rn <br><br><b>Service: </b>”.$_POST[‘service’].” rn <br><br><b>Budget: </b>”.$_POST[‘budget’].” rn <br><br><b>Comments: </b>”.$_POST[‘comments’];
$mail->Body = $message;
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@captainscallJul 22.2012 — Looks like you're using object-oriented programming for the e-mail to yourself.. you could simply add some non OOP PHP to send the user an email too:
[CODE]
$to = $_POST['email'];
$subject = 'Thanks for contacting Digital Frog';
$msg = 'Hello, thanks for contacting Digital Frog. We have recieved your correspondence and will get back to you as soon as we can.nnBest,nThe Digital Frog Team';
mail($to, $subject, $msg);
[/CODE]
Copy linkTweet thisAlerts:
@MekatekAug 11.2012 — Hi there, you can use the same Class to send the auto reply after checking the first one was sent

Like:

if($mail->Send()){

}
×

Success!

Help @popcop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...