• Resolved hanscz

    (@hanscz)


    The notification default email carrier uses wp_mail() to send its emails, so according to the wp_mail() function reference, it would be possible to send to recipients of the format ‘User Name <[email protected]>’.

    Looking at parse_value() in the default email recipient, I see the following:

    		$parsed_emails = [];
    		$emails        = is_array( $value ) ? $value : explode( ',', $value );
    
    		foreach ( $emails as $email ) {
    			$parsed_emails[] = sanitize_email( $email );
    		}

    So it would seem that recipients of the format ‘User Name <[email protected]>’ will be stripped down to ‘[email protected]’ by sanitize_email().

    I am considering creating a recipient that supports the ‘User Name <[email protected]>’ format. But before I do, I am curious as to if you have any particular reason to not support the ‘User Name <[email protected]>’ format, or if you maybe encountered any stumbling blocks that made it impractical.

    Thank you.

    • This topic was modified 3 years, 1 month ago by hanscz.
Viewing 1 replies (of 1 total)
  • Plugin Author Kuba Mikita

    (@kubitomakita)

    Hi @hanscz, that’s a good question!

    The reason why it’s allowing only emails is the flexibility of the plugin. The recipients can come from all kinds of different places and we don’t always know the name attached to the email. Sanitization would be much more difficult as well.

    The Custom Recipients seems like a way to go, at least for now. I don’t see any cons to this approach unless you’re trying to make it work like this for every recipient and every carrier ??

    Let me know if you have any more questions!

Viewing 1 replies (of 1 total)
  • The topic ‘Email recipients with names – why not?’ is closed to new replies.