Mikael
Mikael

Reputation: 1319

PHP SwiftMailer from string to Message object

As we know we can get email string from Swift Message object:

$message = new Swift_Message();
$message->setSubject("hi");
$message->attach(Swift_Attachment::fromPath('a.txt'));
$message->toString();

But can I parse mail string into Message object ? Great thanks!

Upvotes: 0

Views: 1037

Answers (2)

Umut KIRGÖZ
Umut KIRGÖZ

Reputation: 2123

I think php-mime-mail-parser can solve your problem:

A fully tested email parser for PHP 7.1+ (mailparse extension wrapper). It's the most effective php email parser around in terms of performance, foreign character encoding, attachment handling, and ease of use. Internet Message Format RFC 822, 2822, 5322.

https://github.com/php-mime-mail-parser/php-mime-mail-parser

Upvotes: 1

Mikael
Mikael

Reputation: 1319

IT's not possible with Swift mail

Upvotes: 0

Related Questions