Just use the URL… No encoding needed. You only need to encode it if you are sending special characters.
It should work as-is without any encoding. If for some odd reason you think you need to add encoding, you can use the first version using the rawurlencode() function, but, it is NOT needed.
How are you putting this into your email? Are you sending a plain-text email or a full html-email. These days everyone uses html-email. Therefore, you need to create a link in the email using an “anchor”. This will include the “HREF” which would be your URL. BUT, you need to “ESCAPE” the special characters like quotes… Here is a way around that. Just put the link right into the URL when you create it.
Something like this:
$Url = "<a href='https://somedomain.net/core/index.php?email2=\"firstname.lastname@example.org\"&user=\"Frank Bob
"'>Text for reader to see in email...</a>";
Notes: To create a URL LINK in an email, you need to echo it in PHP to the email. But, then, the quotes inside of other quotes need to be ESCAPED. BUT, only if the outer quotes are used again inside the string. This means that if you use DOUBLE-QUOTES at beginning and end of the PHP variable creation, you do not need to escape SINGLE-QUOTES. BUT, you do need to escape DOUBLE-QUOTES inside of other DOUBLE-QUOTES. This is to prevent the outer-and-ending DOUBLE-QUOTES from ending the string before you are finished. Hope that makes sense. Once you create that, you can just echo the $Url variable inside the email wherever you want it.
I realize this can be confusing. Many many people have had issues with quotes inside of other quotes. Something it gets very tricky to sort them out. This one is easy!