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

Make Grunion Contact form plugin send emails WordPress

  • SOLVED

I need to make the Grunion Contact form plugin send emails to the email address used when submitting the form. By default Grunion only sends the email to the person who the mail is being sent to, however my client requires it to be sent to the person submitting it too.

This either needs to be as a separate plugin or at last resort, hacking the Grunion Contact form plugin itself could be done.

<strong>[[LINK href="http://wordpress.org/extend/plugins/grunion-contact-form/"]]Grunion Contact Form plugin[[/LINK]]</strong>


Thanks :)

Answers (2)

2011-05-06

Denzel Chia answers:

Hi,

Please open the file grunion-contact-form.php and go to line 525 and find


return wp_mail( $recepient, $subject, $message, $headers );


Change to this


$recepient = array($to,$comment_author_email);
return wp_mail( $recepient, $subject, $message, $headers );


wp_mail takes array as the first variable for multiple receipents.
So I guess $comment_author_email is the email address of the form writer.
http://codex.wordpress.org/Function_Reference/wp_mail

Please try it out and get back to me if it does not work.

Thanks.
Denzel


Denzel Chia comments:

Hi,

Sorry. please use this instead. Made a stupid mistake.


$recepient = array();
array_push($recepient,$to);
array_push($recepient,$comment_author_email);
return wp_mail( $recepient, $subject, $message, $headers );


Thanks.
Denzel


Ryan Hellyer comments:

Thanks. Tested the old code. Now trying the new code.


Ryan Hellyer comments:

Dang it. Gotta wait for mail server to clear. This could take a while.


Denzel Chia comments:

Hi,

It has been quite a while.
Is it working for you?

Thanks.
Denzel


Ryan Hellyer comments:

I think my server is not sending emails. I'll need to sort out a solution to that problem first unfortunately. I'll have a crack tomorrow and see if I can get it working.


Denzel Chia comments:

Hi,

How is it? Is your mail server working now?

Thanks.
Denzel


Ryan Hellyer comments:

I haven't forgotten about this, I'm just suffering some sever computer issues.

If you can confirm it works I'll happily mark you as the winner. I just don't have the time to figure out why my mail server isn't working right now unfortunately.


Ryan Hellyer comments:

Sorry for continuing to take a long time to respond.


I didn't get it working with the code that you provided, but you pointed me in the direction of <strong>where</strong> to look, and from there I just re-used the wp_mail() function with the raw email string rather than using an array. That seemed to work just fine.

if ( !$is_spam ) {
wp_mail( $comment_author_email, $subject, $message, $headers );
return wp_mail( $to, $subject, $message, $headers );
}



Thanks for your help :)

2011-05-09

Court Rye answers:

Hey guys, I've been working on a similar thing but each time I add my custom email address (in the form of a function or variable) it just gets posted above the form on my pages instead of in the to="" space in the back end. I've come at this from multiple angles. Can you think of another way to do this?

Here's the code I am using, note the "tdomf_the_submitter_email" is a field created by a plugin called TDO Mini Forms that captures the email of people who create new pages (like a wiki).


$to = array();
array_push($to,$tdomf_the_submitter_email);
return wp_mail( $to, $subject, $message, $headers );
// return wp_mail( $to, $subject, $message, $headers );


Thanks guys, I've been working on this for over 20 hours between yesterday and today.