5

I have installed TURNKEY LAMP(updated today, 02 december 2012). It's used with an Oracle VM VirtualBox. This virtual server has linux, apache, php, mysql and Postfix MTA (bound to localhost) to allow sending of email from web applications.

The thing is that i can't send mails using Postfix, because i don't know which username or password to use, or the port.

I use for sending mails SwiftMailer, with PHP code. I have successfully send mails using one of my web-site servers:

// Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 465, 'ssl')
  ->setUsername('myusername@mywebsite.net')
  ->setPassword('mypassword')
  ;

or using my gmail account:

    // Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
  ->setUsername('myusername@gmail.com')
  ->setPassword('mypassword')
  ;

Swiftmailer support PostFix, it's written in their documentation.

I use Postfix mail Server interface from my Lamp virtual server. Postfix mail Server interface

Please, can you tell me how to send mails using these?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alin Alexandru
  • 139
  • 1
  • 6

1 Answers1

3

To use Postfix (sendmail) you need to use SendMail transport that is bundled with SwiftMailer. There is little example:

// Create the Transport
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
Michael Sivolobov
  • 12,388
  • 3
  • 43
  • 64