Email

Home Forums Quform WordPress Email

This topic is: resolved
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #7295
    lawrencepepper
    Participant

    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

    #7314
    lawrencepepper
    Participant

    I 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

    #7315
    lawrencepepper
    Participant

    What 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

    #7320
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #7435
    lawrencepepper
    Participant

    See below….

    #7436
    lawrencepepper
    Participant

    Tried this:


    #Set Approval Email

    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 = $row['supervisor_email'];

    return $mailer;
    }
    add_filter('iphorm_pre_send_notification_email_7', 'mytheme_modify_recipients', 10, 3)

    Still getting errors.

    L

    #7438
    lawrencepepper
    Participant

    OK,

    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

    #7440
    lawrencepepper
    Participant

    Also,

    I would like to set the “From ” address as well, how can I incorporate that into the code above as well?

    L

    #7450
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #7458
    lawrencepepper
    Participant

    Hello 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);

    #7459
    lawrencepepper
    Participant

    OK,

    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

    #7472
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy