Jump to content

mail() with remote smtp on linux not windows


nand

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)

 

or

 

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

Link to comment
Share on other sites

  • 5 years later...
Hey,

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

[code=php:0]
<?php
require_once('Zend/Mail.php');

$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 );

[/code]

have fun
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.