goetas/to-swift-mime-parser

解析通用邮件流,并将其转换为SwiftMailer消息

2.3.0 2021-03-07 19:52 UTC

This package is auto-updated.

Last update: 2024-09-08 03:38:52 UTC


README

解析通用邮件流,并将其转换为SwiftMailer消息对象

Build Status Code Coverage Scrutinizer Code Quality

安装(composer)

composer requre goetas/to-swift-mime-parser

用法

<?php

$parser = new \Goetas\Mail\ToSwiftMailParser\MimeParser();

// read a mail message saved into eml format (or similar)
$inputStream = fopen('mail.eml', 'rb');

$mail = $parser->parseStream($inputStream); // now $mail is a \Swift_Message  object

// edit the email
$mail->setFrom("me@you.it");
$mail->setTo("me@you.it");
$mail->setSubject("New Subject");


// optionally loop through mail parts (and edit it!)
// $mail->getChildren();

// send a new mail
$mailer->send($mail);