Question

I want to have the "From" part of a php generated email be just from the company name. Apparently that makes spam filters sad. So, my code is...

$mail->FromName = 'Company Name <some_email@domain.com>';

My issue is that gmail and aol keep returning these emails and the from part looks like this...

From: "Company Name <some_email@domain.com>" <>

Any thoughts about the "<>" at the end?

Was it helpful?

Solution

The <>at the end of "Company Name <some_email@domain.com>" <> indicates that the address is interpreted as containing only the associated name part,with no real email address.

Try generating the From address as 'Company Name' <some_email@domain.com> or as some_email@domain.com (Company Name)

Edit: Another possible reason for this problem is that your mailer is using separate fields for the name part and the address part of the From header. If so:

$mail->From = "some_email@domain.com";
$mail->FromName = "Company Name"; 

should solve the problem.

OTHER TIPS

In any decent mail program (MUA) you should be able to see the raw content and headers of emails you've sent and which have been sent to you. If you have a look at some of the latter you'll see that the correct way to do it is:

$from='"Human readable version of address" <mailbox@domain.com>';

BTW: The title of your post says you are using the mail() function but your example code does not call an functions. Your code implies that you are some sort of class to implement your email, but you've provided no details of what that class is - and AFAIK there is no standard class bundled in PHP. Therefore we've no idea what your code is actually doing with the address you feed to it - if it's an off the shelf package it should have come with documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top