Marius Butuc
Marius Butuc

Reputation: 18250

Use Amazon’s SES to send email from PHP site

I want to use Amazon’s SES (Simple Email Service) through the Developer Scripts for a PHP site, on an Ubuntu instance.

So far I'm successful in

  1. verifying an email
    ./ses-verify-identity.pl -k ./aws-credentials -v [email protected]
  2. use ses-send-email.pl with the same credentials to send a test email

But when I try to bind them into the sendmail_path config in php.ini

sendmail_path = "/opt/third-party/amazon/ses/ses-send-email.pl -k /opt/third-party/amazon/ses/aws-credentials -f [email protected] -r"

All I get in the Apache error log is this:

Unknown option: oi
Usage:
    ses-send-email.pl [--help] [-e URL] [-k FILE] [--verbose] -s SUBJECT -f
    FROM_EMAIL [-c CC_EMAIL[,CC_EMAIL]...] [-b BCC_EMAIL[,BCC_EMAIL]...]
    TO_EMAIL[,TO_EMAIL]...

    ses-send-email.pl [--help] [-e URL] [-k FILE] [--verbose] -r [-f
    FROM_EMAIL] [TO_EMAIL[,TO_EMAIL]...]

Can anybody please help me out?

Upvotes: 1

Views: 1426

Answers (1)

Marius Butuc
Marius Butuc

Reputation: 18250

The error happens because PHPMailer calls the Postfix sendmail(1) with the option -oi:

  -oi    When reading a message from standard  input,  don't
         treat  a line with only a . character as the end of
         input.

which is not handled by ses-send-email.pl.

One possible fix is to just discard that option.

Upvotes: 1

Related Questions