Jump to content


This topic is now archived and is closed to further replies.


mail() with remote smtp on linux not windows

Recommended Posts

this issue is not about core php hacking, but I guess this topic fits here best.


I want to make php mail() function send emails using remote smtp server. I want to force this to all mail() users at my servers. However I use linux php so I cant specify remote smtp in php.ini cause php passes emails directly to sendmail/qmail ... (ps. I dont need script to use with remote smtp by socket connections, i want to make MAIL() do it so my users dont have to change anything at their source).


So what I need is


a) MTA like sendmail that actualy dont send mails to repicients, but it transfers it to remote mta-smtp (ps. I dont want relay, cause I dont want relaing to be visible in source of message)




b) some core hack-mod to make php mail() with php.ini work like on windows - not with sendmail/qmail but with socket connection to smtp.


Any ideas.. I guess not

Share this post

Link to post
Share on other sites

Read your little question. What you want to do is in download the Zend_Mail class. And the make a script like this:


$config = array(
'auth' => 'login',
'username' => 'you@gmail.com',
'password' => 'gmailPassword',
'port' => 465
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText( "email message" );
$mail->setFrom( recipientEmail, recipientName);
$mail->addTo( $email );
$mail->setSubject('form submission');
$mail->send( $transport );


have fun

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.