Support » Plugin: Volunteer Sign Up Sheets » commas in First Name field cause glitch

  • Resolved cynops

    (@cynops)


    Someone put multiple names, separated by commas, into the First Name field of their signup. The rest of their signup was normal, including a valid email address. The result was that the software was confused about where to find the email address, and tried to send email to the first word in the First Name field. When the reminder email went out, the admins received bounce notices from repeated attempts to email something that wasn’t an email address.

    Not a major bug, just thought you might want to know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author DBAR Productions

    (@dbar-productions)

    The code my plugin uses to set the “to” variable that is sent to the wp_mail function (which is the WordPress emailer function, not something I created), looks like this:

    
    $to = $signup->firstname . ' ' . $signup->lastname . ' <'. $signup->email . '>';
    

    which is the way WordPress recommends formatting an email address, so you end up with something like:
    “john doe <johndoe@email.com>”

    However, if you look at the wp_mail function in WordPress it gives this detail for the input variables:

    
    * @param string|string[] $to          Array or comma-separated list of email addresses to send message.
    

    So, WordPress will accept multiple email “to” addresses separated by commas. My guess is what happens in your situation is that the $to address was something like:
    “Steve, John, and Mary <emailaddress@email.com>”
    in which case, WordPress thinks it is 3 emails for the to address, but the first 2 don’t actually have a real email, so those will get rejected, but you should still get an email that would appear as “and Mary <emailaddress@email.com>”, which would still be deliverable.

    On my local dev system, the above situation resulted in a delivered email as specified above. I didn’t get any bounce notifications, but not sure if my PHP mail catcher for testing emails would generate those. Also probably depends on if you are using the built-in WordPress wp_mail plugin, or if you are using an SMTP mailer plugin which replaces the wp_mail plugin. If using a SMTP mailer plugin that doesn’t validate the “to” addresses first, that could cause the errors.

    The only way I could fix this on my end would be to strip out any commas in the first or last name before building the $to email address variable. I’m pretty sure I never use multiple “to” email addresses in my plugin, so that’s probably the best solution to avoid any issues.

    Plugin Author DBAR Productions

    (@dbar-productions)

    This has been fixed in version 3.7.1 – commas are stripped from names when using them as part of the email address.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘commas in First Name field cause glitch’ is closed to new replies.