Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Mailgun API newline
  • I am sending emails from my FuelPHP page via Mailgun API.
    No matter what I set to "new line" on fuel/all/config/email.php, delivered email body does not make any new line. It's delivered all in one line.

    It works fine when I use Mailgun via SMTP.
    It happens when I set the "driver" to "mailgun". Also URL in the mail body is not recognized as URL when I send them via API, works fine with SMTP.
  • HarroHarro
    Accepted Answer
    The Mailgun API expects a HTML message body, and in HTML, whitespace is not significant.

    So you need to format your message in HTML, or use nl2br() on the message to convert the new lines to HTML breaks.
  • Thank you Harro.
    I solved it in a different way.
    Rather than using Mailgun API thru Email package, I manually newed Mailgun class then sent mail like it showed on Mailgun API doc.

    $mg = new Mailgun¥Mailgun("MY_API_KEY"); 

    It worked perfectly. Like you said, Mailgun API expects HTML string and generate MIME on their own.
  • Ok, thanks for the feedback.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion