www.webdeveloper.com
Results 1 to 3 of 3

Thread: An automatic email reply to sender from php Form

  1. #1
    Join Date
    May 2004
    Posts
    288

    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??

    PHP Code:
    //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 "hello@frogdigital.co.uk";  // 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("hello@frogdigital.co.uk""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']." \r\n <br><br><b>Email: </b>".$_POST['email']." \r\n <br><br><b>Service: </b>".$_POST['service']." \r\n <br><br><b>Budget: </b>".$_POST['budget']." \r\n <br><br><b>Comments: </b>".$_POST['comments'];
    $mail->Body    $message

  2. #2
    Join Date
    Jun 2012
    Location
    FL, USA
    Posts
    48
    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.\n\nBest,\nThe Digital Frog Team';
    mail($to, $subject, $msg);

  3. #3
    Join Date
    Aug 2012
    Posts
    15
    Hi there, you can use the same Class to send the auto reply after checking the first one was sent

    Like:

    if($mail->Send()){

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles