Reputation: 429
My message on from parameter comming with angles quotes, like that:
MyFromName <New message!>
I try $mail->ClearAllRecipients()
, but not work.
Any tips?
Upvotes: 0
Views: 47
Reputation: 37710
Nope. You can't do this. It's part of the email specification, which says a mailbox (which is the thing you're talking about) is made up of:
mailbox = name-addr / addr-spec
name-addr = [display-name] angle-addr
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] /
obs-angle-addr
That means an address can be in one of two forms when it appears in a header; as a name and address:
User Name <[email protected]>
Or as just an address:
[email protected]
Nearly everything uses the former, and usually if the name is given, that is displayed in preference to the address part, however, that is entirely up to the client application you're using to display the message, over which you have no control at all.
If you remove the angle brackets and keep the name, your message will never arrive because it's an invalid format.
Upvotes: 1
Reputation:
You can use a replace function, for example;
function removeAngleBrackets($from)
{
// Create an array of things to replace
// Use both standard and html encoded to cover basis (you could use the ASCII too)
$replace = array("<", ">", "<", ">");
// Create the variable to replave the strings with
$replace_with = "";
// Replace this in the string and return the value when done
return str_replace($replace, $replace_with, $from);
}
Calling this on your string will remove the angle braces
Upvotes: 0