How to send an iCal meeting request using TransportBuilder in magento 2.x


How to send an iCal meeting request using TransportBuilder in magento 2.x



I want to integrate iCal meeting request with mail (in magento 2.2.4 v ). I am trying with following way but it doesn't work. Please help.


iCal


magento 2.2.4 v



It shows as attachment in mail with .bin file


.bin



TransportBuilder.php


namespace VendormoduleMagentoMailTemplate;

class TransportBuilder extends MagentoFrameworkMailTemplateTransportBuilder
{


const TYPE_TEXTCALENDER="text/calendar";

public function addAttachment(
$body,
$filename = null,
$mimeType = self::TYPE_TEXTCALENDER,
$disposition = Zend_Mime::DISPOSITION_ATTACHMENT,
$encoding = Zend_Mime::ENCODING_BASE64
) {
$this->message->createAttachment($body, $mimeType, $disposition,
$encoding, $filename);
return $this;
}
}



send mail code :-


.............
$transport = $this->_transportBuilder-
>setTemplateIdentifier('template_identifier')
->setTemplateOptions($templateOptions)
->setTemplateVars($templateVars)
->setFrom($from)
->addTo($to)
->addAttachment($ical)
->getTransport();
$transport->sendMessage();



please check below link of sample ical file am using :-
https://gist.github.com/DeMarko/6142417





What exactly does not work with the given code? What happens instead?
– Nico Haase
Jun 25 at 8:32





Please check below link, i want same type of functionality but in magento 2.0 julian-young.com/2009/07/07/php-ical-email
– Dipesh More
Jun 25 at 8:47






As you've already posted some code, please tell us what is not working with the given code
– Nico Haase
Jun 25 at 8:48





calendar event not added in mail it add as attachment file in received mail
– Dipesh More
Jun 25 at 8:51






And what have you tried to debug this? What does $ical contain? Is the method to attach the file even called?
– Nico Haase
Jun 25 at 8:54


$ical









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift