Jump to content

on Mail() success


denoteone

Recommended Posts

One of 2 things I would suggest then.. 1, if all is good for your script to mail.. ad in it a header to redirect within a few seconds

 

my code looks like this to send an email.

 

if(isset($_POST["sendmail"])) mail($to, $subject, $emailmessage, $headers);

 

I need for it to go to a "Thank You" page on success? 

 

if(isset($_POST["sendmail"])) {
mail($to, $subject, $emailmessage, $headers);
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"3\"; url=\"http://www.yourdomain.com/index.html\">";
} else {
} 

 

or if your page is just a blank so to speak other then your template after the mail is sent you can use a similar concept and just do an include with a thank you note php file.. Which I would suggest that over the refresh/redirect but thats me. Or you could even echo/print out a thank you note for that matter all depends how you wanna handle things I suppose.. 

Link to comment
https://forums.phpfreaks.com/topic/83464-on-mail-success/#findComment-424658
Share on other sites

i am going to do the redirect to a thank you page but all it is doing is refreshing the page. that it is on.

 

my code now looks like this now. i want for it to got to http://www.bloomingcanvas.com/mike/thankyou.html  once it is done sending the email.

 

 

 
if(isset($_POST["sendmail"])) {
mail($to, $subject, $emailmessage, $headers);
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"3\"; url=\"http://www.bloomingcanvas.com/mike/thankyou.html\">";
} else {
} 

Link to comment
https://forums.phpfreaks.com/topic/83464-on-mail-success/#findComment-424668
Share on other sites


<?
   
    $to = $_POST['guestemail'];
    $from = $_POST['usersemail'];
    $name = $_POST['guestname'];
$sendername = $_POST['usersname'];
$message = $_POST['themessage'];
$subject = "$name Please join us at the next FX";




  
$emailmessage = <<<EOF
<html>
  <body bgcolor="white">

<table align="center" border="1" bordercolor="gray" width="400">
    <tr>
       <td width="400" align="center">
        <img src="http://www.bloomingcanvas.com/mike/title.gif"/><br/>
       </td>
    </tr>
    
    <tr>
       <td>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt">Dear $name</font><br/><br/>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=12pt">On January 5th, we would like to invite you to the next FX.  FX stands for Family Experience.  During the FX program... <br/><br/>$message <br/><br/> January 5th at 5:30 PM  Do not be late, the start of the show is always action packed!</font> <br/><br/>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt"> <br/> $sendername </font><br/><br/>
       <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=10pt"> Click here for directions<a href="http://www.mapquest.com/maps/map.adp?address=7689%20Bethany%20Rd&city=Liberty%20Township&state=OH&zipcode=45044%2d9515&country=US&title=%3cb%20class%3d%22fn%20org%22%3e7689%20Bethany%20Rd%3c%2fb%3e%3cbr%20%2f%3e%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22locality%22%3eLiberty%20Township%3c%2fspan%3e%2c%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22region%22%3eOH%3c%2fspan%3e%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22postal%2dcode%22%3e45044%2d9515%3c%2fspan%3e%2c%20%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22country%2dname%22%3eUS%3c%2fspan%3e%3c%2fspan%3e&cid=lfmaplink2&name=&dtype=s">Map of 7689 Bethany Rd Liberty Township, OH 45044-9515,  US</a>
       </td>
    </tr
</table>
</body>
</html>
EOF;





$success_sent_msg = <<<EOF
<html>
  <body bgcolor="white">

<table align="center" border="1" bordercolor="gray" width=400>
    <tr>
       <td align="center">
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=12pt">Please Review your message and click Send below to send your email</font>
        <img src="http://www.bloomingcanvas.com/mike/title.gif"/><br/>
       </td>
    </tr>
    
    <tr>
       <td width=400>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt">Dear $name</font><br/><br/>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=12pt">On January 5th, we would like to invite you to the next FX.  FX stands for Family Experience.  During the FX program... <br/><br/>$message <br/><br/> January 5th at 5:30 PM  Do not be late, the start of the show is always action packed!</font> <br/><br/>
        <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=14pt"> <br/> $sendername </font><br/><br/>
       <font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=10pt"> Click here for directions<a href="http://www.mapquest.com/maps/map.adp?address=7689%20Bethany%20Rd&city=Liberty%20Township&state=OH&zipcode=45044%2d9515&country=US&title=%3cb%20class%3d%22fn%20org%22%3e7689%20Bethany%20Rd%3c%2fb%3e%3cbr%20%2f%3e%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22locality%22%3eLiberty%20Township%3c%2fspan%3e%2c%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22region%22%3eOH%3c%2fspan%3e%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22postal%2dcode%22%3e45044%2d9515%3c%2fspan%3e%2c%20%20%3cspan%20style%3d%22display%3ainline%3bmargin%2dbottom%3a0px%3b%22%20class%3d%22country%2dname%22%3eUS%3c%2fspan%3e%3c%2fspan%3e&cid=lfmaplink2&name=&dtype=s">Map of 7689 Bethany Rd Liberty Township, OH 45044-9515,  US</a>
       </td>
    </tr>
<tr>
<td><a href="#" onClick="history.go(-1)">Click Here</a><font style="font-family:verdana,arial,helvetica; font-color=GRAY; font-size=10pt">to make changes</Font><form action="test5.php" method="post"><input type="hidden" name="guestemail" value="{$to}" /><input type="hidden" name="usersemail" value="{$from}" /><input type="hidden" name="guestname" value="{$name}" /><input type="hidden" name="usersname" value="{$sendername}" /><input type="hidden" name="themessage" value="{$message}" /><input type="submit" name="sendmail" value="Send Email" /></form>
</td>
</tr>

</table>
</body>
</html>
EOF;

echo $success_sent_msg;

    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";
    $to = "$to, $from"; // this will send to both emails at the same time.
    // now lets send the email.


  
  if(isset($_POST["sendmail"])) mail($to, $subject, $emailmessage, $headers);

  
?>


 

this is the code that sends the html email. I just need it to redirect to the thankyou page.

Link to comment
https://forums.phpfreaks.com/topic/83464-on-mail-success/#findComment-424726
Share on other sites

Shouldn't the code below refresh the page and show http://www.bloomingcanvas.com/mike/thankyou.html    when the user presses the sendmail button? because all it is doing is refreshing the current page.

 

 


if(isset($_POST["sendmail"])) {
mail($to, $subject, $emailmessage, $headers);
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"3\"; url=\"http://www.bloomingcanvas.com/mike/thankyou.html\">";
} else {
}

Link to comment
https://forums.phpfreaks.com/topic/83464-on-mail-success/#findComment-424806
Share on other sites

Sorry, I was assuming you had a middle page.. inbetween the form and the actual sending of the mail, kind of like a confirmation page..

 

form > confirmation > thank you

 

I would have it check via the confirmation to make sure all is good for sending, and if so then refresh/redirect to the thank you.. however if you don't want to do the confirmation concept then I would say use an include rather then a redirect.. so that way if all checks out for a sendable mail it will also include the thank you part, again all in all its up to how you want to do it..

Link to comment
https://forums.phpfreaks.com/topic/83464-on-mail-success/#findComment-424934
Share on other sites

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.