如何让PHPMailer忽略'from'电子邮件地址并仅显示名称?

I'm using PHPMailer with the same SMTP configuration as my outlook.

Let's say that my email is "b@example.com" and name is "Bob, b". When I send a mail from my outlook to "Alice" at "a@example.com". In her outlook client she will only see "Bob, b" and she will not see my email address in the header.

When sending the same mail from "PHPMailer" Alice will see in her outlook "Bob, b {b@example.com}"

When I tried to set it without the email:

$mail->setFrom('Bob, b');

The smtp added {root@mysmtpblabla.example.com}

Can PHPMailer handler such a case? sending with name only?

It really helps to actually read the docs for the function you're calling.

Applying that info to your example, you should do this:

$mail->setFrom("b@example.com", "Bob, b");

In most email clients it will display the name and not the email - in Outlook or Apple Mail it will usually show you the email address next to the name or on rollover - just because it doesn't display the address doesn't mean that there isn't one!

Some email services will not let you send from arbitrary addresses (such as gmail), so you may still find the from address itself changes.

You should not try to send without a from address for all the reasons Michael_B gave, plus that it's also very unlikely to work at all; that's why both PHP and PHPMailer add one that's generated automatically from your hostname.