Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Mailgun API newline
oldy
April 2016
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.
Harro
April 2016
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.
oldy
April 2016
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.
Harro
April 2016
Ok, thanks for the feedback.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
April 2016
oldy
April 2016