PHP code example of bariew / to-swift-mime-parser
1. Go to this page and download the library: Download bariew/to-swift-mime-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bariew / to-swift-mime-parser example snippets
$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("[email protected]");
$mail->setTo("[email protected]");
$mail->setSubject("New Subject");
// optionally loop through mail parts (and edit it!)
// $mail->getChildren();
// send a new mail
$mailer->send($mail);