Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

PHP mailto redirection to thank you/contact page WordPress


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?


Answers (8)


phppoet answers:

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

my skype is phppoet



Asad Iqbal answers:

Can you share your code here?


Abdelhadi Touil answers:

Hope these links help you:

[[LINK href=""]][[/LINK]]

[[LINK href=""]][[/LINK]]

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


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 :-)


ej_emman answers:

Hello Tremblayly,

I see your problem. I understand that you use like this coder <strong><a href="mailto:[email protected]?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 . And this will be you simple custom form code.

#This will process the form
if(isset($_POST)AND $_POST['send'] == 'SENDMAIL'):?>
<?php $sent = mail($_POST['fromemail'],$_POST['subject'],$_POST['message'],$_POST['toemail']);
header("Location: ".$_POST['redirecturl']);
<?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" />

2.) Instead of using this link <a href="mailto:[email protected]?Subject=Hello%20again"> change it to
<a href="">

Its my pleasure to help you.



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:, in the iPhone sidebar widget.



Yakir Sitbon answers:

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



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.


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> (instead of Contact Us button could be each one of you're 4 links).


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?


MDan comments:

Hi Lyse,

First of all head to the plugin page and download the zip package.

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: