Skip to content

RobertRupa/email-attachments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmailAttachments

Email attachment extension for Magento 2.3.x

Installation

- Form composer

  • composer require robertrupa/email-attachments

- Copy/clone files

  • Download or copy files to app\code\RobertRupa\EmailAttachments

Usage

Example for contact form: Make preference for Magento\Contact\Model\Mail

$file_path = 'media/directory/file.jpg'; 
$fileName = 'file.jpg';
$transport = $this->transportBuilder
    ->setTemplateIdentifier($this->contactsConfig->emailTemplate())
    ->setTemplateOptions(
        [
            'area' => Area::AREA_FRONTEND,
            'store' => $this->storeManager->getStore()->getId()
        ]
     )
     ->setTemplateVars($variables)
     ->setFrom($this->contactsConfig->emailSender())
     ->addTo($this->contactsConfig->emailRecipient())
     ->addAttachment($file_path, $fileName)
     ->setReplyTo($replyTo, $replyToName)
     ->getTransport();
$transport->sendMessage();

About

Email attachment extension for Magento 2.3.x

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages