Setting a custom header in Pear Mail

Hi all,

Im using Pear to send email from my script. However its getting caught in the client’s spam filtering software.

My code is:

$host = "smtp.office365.com";
	$username = "##";
	$password = "###";
	$port = "25";
	$to = "###";
	$headers['Cc'] = $requestData['email'];
	$headers['From'] = "###";
	$headers['Subject'] = $subject;
	$email_body = $message;
	$mime->setHTMLBody($email_body);

How can I set a custom header in this email so that I can detect these legit emails in the sam filtering software and let them through?
Thanks

If the mail is always coming from your script, what email address are you sending from? I am wondering whether it’s easier to white-list the sender. Does the spam filtering software not tell you why it’s trapping those emails?

In any case, adding headers with Pear mail: https://pear.php.net/manual/en/package.mail.mail-mime.headers.php

Thanks. Ive done white-listing and various other things and it still gets filtered! So adding a custom header that I can test against in the spam software is my ‘Plan B’!

So - regards adding a custom header - can I create the name of my own header or can I only use a predefined header name? If I can only use an existing header, what would be the best one to use in my scenario? And is it as simple as adding the line:

$headers['header_name'] = "a value that I set";

Many thanks!

What happens if you try it with a customer header name?

I don’t know the “rules”, but I do know that various spam filters tend to add headers of their own, so that would suggest that you can pretty much make them up as you wish. Stuff like “X-RBL-Scan” and the like are headers I recall, and the name usually suggests which filter has added them. This kind of thing:

and I figure that’s something 1&1 add in as needed.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.