2

I'm currently using SMTP (connecting to Office365) to launch an email (using PEAR in PHP) whenever someone visits a page for an email notification on my Linode server (Ubuntu 15.04). My problem is that connecting to the Office365 server takes quite some time (~10 seconds), and because of this it takes a long time for the page to load until the email is sent. Is there any way for me to somehow use PEAR to send mail in the background without altering the user's page load time?

I've looked at PEAR Mail Queue and that seems like an option, however I'm wondering if there's a workaround rather than having a cron job running every x minutes

user97461
  • 23
  • 4

1 Answers1

0

Don't send mail directly to O365 from your application.

Instead, configure a local MTA (probably postfix) to relay mail to O365. This way, your application can deliver mail to your local MTA, which will be very fast, and then postfix can handle getting the mail to O365.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • I'm not entirely sure how to do that but I'll read up on it. Thanks a bunch! – user97461 Oct 31 '15 at 03:32
  • @user97461 Install Postfix or another MTA on the server, (it may already be installed) configure it to use O365 as a smarthost, and then use the `sendmail` backend in your `Mail::factory()` call. – Michael Hampton Oct 31 '15 at 03:46