php mail FROM address

Permalink 3 users found helpful
Hi All,

I run a shared hosting service where quite a few customers use Concrete5.

Most shared hosting services disable the use of phpmail to prevent spam, but others like myself allow it to be used provided the correct parameters are passed, namely the FROM address has to be specified (note that this is not the same as inserting a FROM address into the email header).

None of my users who were using php mail function were able to send/receive emails in Concrete5. Having done a quick search here there didn't seem to be a solution to this so I'll post what I've found incase it helps other people.

Its a simple change really - open up this file:
/concrete/libraries/3rdparty/Zend/Mail.php

Find this line:
$transport = new Zend_Mail_Transport_Sendmail();

Edit it to look like this:
$transport = new Zend_Mail_Transport_Sendmail('-fNoReply@domain.com');

Note the -f followed by the email address with no space inbetween.

And whoala! This allows the system to connect to the mail server using the FROM address specified here.

Note that this is the equivalent of adding the -f parameter to sendmail (which is basically what this is doing) and adding the fifth parameter to the phpmail() function.

Although this uses Zend_Mail, if the concrete5 developers could consider somehow implementing this into a future release it would be great :)

 
FatTony1952 replied on at Permalink Reply
FatTony1952
I'm having a send email issue and had one question about this solution. Do you change the domain.com to your domain name or do you leave it as domain.com?
michaelbard replied on at Permalink Reply
This is a stupid problem, and this unfortunately does not solve it. I did change "domain.com" to the name of the domain.
michaelbard replied on at Permalink Reply
This is a stupid problem, and this unfortunately does not solve it. I did change "domain.com" to the name of the domain.