Ask your WordPress questions! Pay money and get answers fast! (more info)

PHP mailto redirection to thank you/contact page WordPress

Hi,

I use html text in a widget in a WordPress sidebar. I created a hypertext mailto: link be sent to a specific email address. A email pop up window gets displayed to compose and send, however once the email is sent I would like to redirect the visitor to a thank you or return to the contact page. Now it get kick out of my website all together.

Can a PHP programmer help with the PHP mailto redirection?

Thanks
Lyse

Answers (8)

2013-04-19

phppoet answers:

yes. I can help you in redirection after successful mail sending . please contact me on skype

my skype is phppoet

regards

2013-04-19

Asad Iqbal answers:

Can you share your code here?

2013-04-19

Abdelhadi Touil answers:

Hi.
Hope these links help you:

[[LINK href="http://stackoverflow.com/questions/3253223/redirect-in-php"]]http://stackoverflow.com/questions/3253223/redirect-in-php[[/LINK]]

[[LINK href="http://stackoverflow.com/questions/15053388/how-to-redirect-to-a-thankyou-page-after-contact-form-submission-wordpress-pre"]]http://stackoverflow.com/questions/15053388/how-to-redirect-to-a-thankyou-page-after-contact-form-submission-wordpress-pre[[/LINK]]

I think what you are looking for is the same as mentioned in the above links.
Good luck.

2013-04-20

Daniel Yoen answers:

this is what you need

1. upload to your theme folder.
2. create new page
3. select template "Contact" in Page Attributes box

Hope this help :-)

2013-04-20

ej_emman answers:

Hello Tremblayly,

I see your problem. I understand that you use like this coder <strong><a href="mailto:someone@example.com?Subject=Hello%20again"></strong> And when you click on this, it will create a custom message form.

I would say that you cannot use this when you want to redirect to a certain page after submission on this form.

My suggestion is:

1.) Create a custom form page. For example you create a page http://yourdomain.com/custompage/ . And this will be you simple custom form code.


<?php
#This will process the form
if(isset($_POST)AND $_POST['send'] == 'SENDMAIL'):?>
<?php $sent = mail($_POST['fromemail'],$_POST['subject'],$_POST['message'],$_POST['toemail']);
if($sent)
header("Location: ".$_POST['redirecturl']);
else
echo 'MAIL FAILED TO SEND';
?>
<?php endif; ?>
<form method="POST">
FROM EMAIL: <input type="email" name="fromemail" /><br />
TO EMAIL: <input type="email" name="toemail" /><br />
SUBJECT: <input type="text" name="subject" /><br />
MESSAGE: <input type="text" name="message" /><br />
<input type="hidden" name="redirecturl" value="http://www.yourdomain/redirectpage/" />
<input type="submit" name="send" value="SENDMAIL" />
</form>


2.) Instead of using this link <a href="mailto:someone@example.com?Subject=Hello%20again"> change it to
<a href="http://yourdomain.com/custompage/">

Its my pleasure to help you.

Cheers.

Joseph


tremblayly comments:

Hi Joseph,

It's somewhat what I need, but is it possible to just have the form as a popup for visitors to complete the fields because I have 4 different topic related emails to send to. Unless you tell me I have to created 4 different custompages for each one.

View my contact page here: www.kelownafuturestennis.com/contact, in the iPhone sidebar widget.

Lyse

2013-04-20

Yakir Sitbon answers:

You can PM me with more info and i can help you.

Yakir.

2013-04-21

rajeshstarlite answers:

Hi tremblayly,

As i read your question description, i found that you have used 'mailto' function of javascript to send out mails, Now with this it's not technically possible to send user/site visitor to thank you page.

So but it's possible with php to send user to thank you page.

2013-04-22

MDan answers:

As Joseph stated, are you sure you want to use <em> mailto</em>?
This means that only users with a fully configured email client can contact you (but these are the days os webmail clients).

Instead, as you're using wordpress already, you could surely try some css/jquery pop-up contact forms.

<strong>Here's some good examples of what you want to achieve:</strong>

http://designwoop.com/labs/model-contact-form/

http://www.html-form-guide.com/files/contact-form/simple-popup-form-1/a-page.php (instead of Contact Us button could be each one of you're 4 links).

http://dev.jonraasch.com/contact-pop/examples/

http://jenniferperrin.com/demos/modalBox/

Thanks
Daniel




tremblayly comments:

Hi Daniel,

Yes this is the sort of popup I would like for each of the different email (as you suggest in eg #3). Now how do I implement this?

Thanks,
Lyse


MDan comments:

Hi Lyse,

First of all head to the plugin page and download the zip package.
http://dev.jonraasch.com/contact-pop/download

1) Extract the contents of the zip package and then upload the Contact-Pop folder to your hosting server through FTP (i presume you're having ftp access).

2) Make sure to include the contact-pop.js and contact-pop.css files in your header. The jquery library version 1.8.2 is already called by your theme thus you could skip including this file. The contact form needs jQuery version 1.3.2 but should work with the version included.

3) Open contact-pop.php and head to the config section. Make sure to change the $siteEmail variable with the email you want to receive emails to.

4) Open js/contact-pop.js and make sure the paths to the files in the config section are correct.

You could also follow the steps as described by the plugin author: http://jonraasch.com/blog/contact-pop-jquery-plugin

Thanks,
Daniel