Jump to content


Photo

mail() with remote smtp on linux not windows


  • Please log in to reply
1 reply to this topic

#1 nand

nand
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 22 September 2005 - 04:20 PM

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

#2 micha8l

micha8l
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 02 January 2011 - 07:20 PM

Hey,

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

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


have fun




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users