Home › Forums › Quform WordPress › Email
- This topic has 11 replies, 2 voices, and was last updated 11 years, 2 months ago by Ally.
- AuthorPosts
- November 7, 2013 at 4:45 pm #7295lawrencepepperParticipant
I can not figure this out.
I have a form that when sent it needs to go to the current users supervisor email.
In my functions file I set up code to grab the current users supervisors email address and set it to a value to be used by my forms.
This value indeed works when used in form elements dynamic default value.
But I see no place in the email settings to use this value.
L
November 8, 2013 at 3:44 pm #7314lawrencepepperParticipantI am having the same sort of problem with another form.
I need the recipient of the email being generated to be a dynamic variable.
How can this be done.
L
November 8, 2013 at 3:47 pm #7315lawrencepepperParticipantWhat I would like to do is have a hidden form field on the form with an email address in it. This email would be the address that the form data goes to.
This way I could dynamically populate the hidden field with whatever email address I need.
L
November 10, 2013 at 11:04 am #7320AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 18, 2013 at 6:27 pm #7435lawrencepepperParticipantSee below….
- This reply was modified 11 years, 2 months ago by lawrencepepper.
November 18, 2013 at 6:38 pm #7436lawrencepepperParticipantTried this:
#Set Approval Emailfunction mytheme_modify_recipients($mailer, $form, $attachments)
{if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$person = $current_user->user_login;
}$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("time", $con);
$result = mysql_query("SELECT * FROM employee WHERE user_name = '$person'");
while($row = mysql_fetch_array($result))
$mailer = $row['supervisor_email'];
return $mailer;
}
add_filter('iphorm_pre_send_notification_email_7', 'mytheme_modify_recipients', 10, 3)Still getting errors.
L
November 18, 2013 at 6:59 pm #7438lawrencepepperParticipantOK,
Figured out the error, I needed a ; at the end of the last line. Oops!
BUT,
The form is not emailing anything now. When submitted it says the form has been sent but nothing shows in email.
Is $mailer the proper field? I want the recipient of this form to be the ‘supervisor_email’ that I am getting form the query.
L
- This reply was modified 11 years, 2 months ago by lawrencepepper.
November 18, 2013 at 7:16 pm #7440lawrencepepperParticipantAlso,
I would like to set the “From ” address as well, how can I incorporate that into the code above as well?
L
November 19, 2013 at 10:05 am #7450AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 19, 2013 at 2:16 pm #7458lawrencepepperParticipantHello Ally,
I tried your suggestion but it still does not work.
If I remove the code and use the static email field set in the form settings the email sends. As soon as I place the code listed above with your suggestion in the functions page it no longer works.
Code I am using:
function mytheme_modify_recipients($mailer, $form, $attachments)
{if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$person = $current_user->user_login;
}$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("time", $con);
$result = mysql_query("SELECT * FROM employee WHERE user_name = '$person'");
while($row = mysql_fetch_array($result))
$mailer->AddAddress($row['supervisor_email']);
return $mailer;
}
add_filter('iphorm_pre_send_notification_email_5', 'mytheme_modify_recipients', 10, 3);November 19, 2013 at 2:39 pm #7459lawrencepepperParticipantOK,
I have it working but not sure why this happens.
In the form settings if I change the mail type to global instead of PHP (mail) it works.
My global default is PHP mail.
So there you go…
L
November 20, 2013 at 11:25 am #7472AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.