Hello all,
I need to convert transctional email to text file , while sending customer , How to do that?
Now, What I done So far,
Open , Magento-sales -> Model -> Order -> Email -> SenderBuilder and edit within Send() method
This is my code.
public function send()
{
$this->configureEmailTemplate();
$this->transportBuilder->addTo(
$this->identityContainer->getCustomerEmail(),
$this->identityContainer->getCustomerName()
);
$copyTo = $this->identityContainer->getEmailCopyTo();
if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'bcc') {
foreach ($copyTo as $email) {
$this->transportBuilder->addBcc($email);
}
}
$transport = $this->transportBuilder->getTransport();
$this->file = $transport;
function __toString()
{
$Msg= $this->file;
$myfile = fopen("email.txt", "w") or die("Unable to open file!");
$txt = $Msg;
fwrite($myfile, $txt);
fclose($myfile);
}
$transport->sendMessage();
}
Then , I send order status via Admin panel , that email sent Customer Account, But, Not create a file.
I try to convert $transport Obejct to String , then Store to File, But not working. No file created
I think I am going wrong Way, because I dont know Which Class Collect all email template and Send to the Customer, I need to That Object then, only I Convert to String to Strore a File.
So, Suggest me, Which class and Method?, Where I go to Edit?.