Hello, I need a little help please.

I want a webform to be automatically resended via mail, just like when it was submitted.

The involved function I think is "webform_submission_send_mail( $node , $submission );"

the $node parameter is fixed at 178 and the $submission (=sid??) is in a variable called $sid.

I got this error:
Warning: Invalid argument supplied for foreach() in /sites/all/modules/webform/includes/webform.submissions.inc on line 186

Here's the code:

$submission = webform_get_submission(178, $sid);
webform_submission_send_mail(178, $submission);

Can someone help me?
thanks

Comments

JFast’s picture

Issue summary: View changes

typo

JFast’s picture

Issue summary: View changes

typo

JFast’s picture

Issue summary: View changes

code

JFast’s picture

Issue summary: View changes

code

quicksketch’s picture

Issue summary: View changes
Status: Active » Fixed

You can already do this in the UI by viewing a submission, then there is a "Resend e-mails" link at the top of the page.

I don't normally help with custom coding questions in the Webform queue, but your code is really close:

$submission = webform_get_submission(178, $sid);
webform_submission_send_mail(178, $submission);

It should be:

$submission = webform_get_submission(178, $sid);
$node = node_load(178);
webform_submission_send_mail($node, $submission);

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.