fightstarr20
fightstarr20

Reputation: 12608

Send email using PHPMailer with empty content

I am trying to send an email using phpmailer https://github.com/PHPMailer/PHPMailer to send an email via SMTP. There is a requirement that the email has no content in the body, only an attatchment.

If I neglect to include $body or set $body = '' then I get an error message telling me that 'Mailer Error: Message body empty'

Does anybody know of a workaround or a way to force PHPMailer to accept a blank body>?

Upvotes: 0

Views: 226

Answers (2)

Synchro
Synchro

Reputation: 37770

It's just a class so make your own subclass, copy the method that throws that error and comment out the check for it. That way you don't need to touch the library.

Upvotes: 1

Ali Mohammadi
Ali Mohammadi

Reputation: 1324

use this: $body = " "; or $body = ";nbsp";

Upvotes: 2

Related Questions