-2

with PHP, we can easily send email with current server if we have installed mail server or DirectAdmin or CPanel and so on ...

now think the situation that we need specif server sends emails, one server should be mail server and another should be Apache + PHP ? how can I achieve that ?

I am using ubunto for both server

Ata
  • 10,914
  • 19
  • 53
  • 94
  • first link on google http://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server – bansi May 24 '14 at 11:25

2 Answers2

0

Try SMTP to send the mail from Another server->

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';

$mail->Host       = "mail.example.com"; // SMTP server example
$mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Port       = 25;                    // set the SMTP port for the GMAIL server
$mail->Username   = "username"; // SMTP account username example
$mail->Password   = "password";        // SMTP account password example
Jitendra Yadav
  • 886
  • 1
  • 6
  • 14
0

There can be at least these two approaches.

1. Using mailer server as SMTP

  • Install and configure an SMTP software like Postfix on the system you want to make mail server

  • Then in the webserver use a library like PHPMailer of SwiftMailer to send email using the mailserver's ip address and created smtp user.

2. Using mail sererver's PHP mail()

This is the other way around.

  • Access the database installed in the webserver in the mailserver machine by using the webserver's ip address as the hostname and the respective username and password.

  • You will need to enable remote connection to the database. If its mysql then you can see the following question: Remote Connections Mysql Ubuntu

Community
  • 1
  • 1
Ghost-Man
  • 2,109
  • 1
  • 19
  • 25