Send Order Email Programmatically Magento 2I do not want to send auto order email in magento 1.9.1.1Send Copy of Order Confirmation email programmatically in magento 2how disable automatic send mail confirmation ORDER in magento?How to send order confirmation email in magento 2 programmatically?Magento 2 - Place an order without sending emailSend order email automaticallyMagento 2 send order & invoice email manuallyLoop through order collection and send email invoiceSend cancelation order email Magento 2 Programmaticallyorder email send to multiple customer(random customer)
Is there any conditions on a finite abelian group so that it cannot be class group of any number field?
Bone Decomposition
Unix chat server making communication between terminals possible
Cine footage fron Saturn V launch's
Can I remove the doors before installing a sliding patio doors frame?
Credit card details stolen every 1-2 years. What am I doing wrong?
Did Voldemort kill his father before finding out about Horcruxes?
When to ask for constructive criticism?
How fast does a character need to move to be effectively invisible?
Link of a singularity
Will a contempt of congress lawsuit actually reach the merits?
Can a Resident Assistant Be Told to Ignore a Lawful Order?
Manually select/unselect lines before forwarding to stdout
Why is my calculation for added length of coax for a double cross antenna different to everyone else's?
Is there an English equivalent for "Les carottes sont cuites", while keeping the vegetable reference?
A scene of Jimmy diversity
Sending a photo of my bank account card to the future employer
Is there a source that says only 1/5th of the Jews will make it past the messiah?
Did 007 exist before James Bond?
What made Windows ME so crash-prone?
Is the Gritty Realism variant incompatible with dungeon-based adventures?
How should the player unlock things?
Why are road bikes (not time trial bikes) used in many triathlons?
What impact would a dragon the size of Asia have on the environment?
Send Order Email Programmatically Magento 2
I do not want to send auto order email in magento 1.9.1.1Send Copy of Order Confirmation email programmatically in magento 2how disable automatic send mail confirmation ORDER in magento?How to send order confirmation email in magento 2 programmatically?Magento 2 - Place an order without sending emailSend order email automaticallyMagento 2 send order & invoice email manuallyLoop through order collection and send email invoiceSend cancelation order email Magento 2 Programmaticallyorder email send to multiple customer(random customer)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How To send Order Email Programmatically
In Magento 2.2.8
magento2 order-email
add a comment |
How To send Order Email Programmatically
In Magento 2.2.8
magento2 order-email
add a comment |
How To send Order Email Programmatically
In Magento 2.2.8
magento2 order-email
How To send Order Email Programmatically
In Magento 2.2.8
magento2 order-email
magento2 order-email
asked Jul 8 at 13:21
Rk RathodRk Rathod
2,6603 silver badges23 bronze badges
2,6603 silver badges23 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can try this code:
$email = 'example@example.com';
$orderid = 100;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderid);
$order->setCustomerEmail($email);
if ($order)
try
$objectManager->create('MagentoSalesModelOrderNotifier')->notify($order);
echo 'You sent the order email.';
catch (MagentoFrameworkExceptionLocalizedException $e)
echo($e->getMessage());
catch (Exception $e)
echo(__('We can't send the email order right now.'));
echo($e->getMessage());
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
add a comment |
Something like this
use MagentoSalesModelOrderEmailSenderOrderSender;
/**
* @var PsrLogLoggerInterface
*/
private $logger;
/**
* @var OrderSender
*/
private $orderSender;
/**
* @param PsrLogLoggerInterface $logger
* @param OrderSender $orderSender
*/
public function __construct(
PsrLogLoggerInterface $logger,
OrderSender $orderSender
)
$this->logger = $logger;
$this->orderSender = $orderSender;
/**
* @return void
*/
public function doStuff()
// load order however you would like
$order = [load order logic]
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
1+ for response
– Rk Rathod
Jul 9 at 8:06
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281224%2fsend-order-email-programmatically-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can try this code:
$email = 'example@example.com';
$orderid = 100;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderid);
$order->setCustomerEmail($email);
if ($order)
try
$objectManager->create('MagentoSalesModelOrderNotifier')->notify($order);
echo 'You sent the order email.';
catch (MagentoFrameworkExceptionLocalizedException $e)
echo($e->getMessage());
catch (Exception $e)
echo(__('We can't send the email order right now.'));
echo($e->getMessage());
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
add a comment |
You can try this code:
$email = 'example@example.com';
$orderid = 100;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderid);
$order->setCustomerEmail($email);
if ($order)
try
$objectManager->create('MagentoSalesModelOrderNotifier')->notify($order);
echo 'You sent the order email.';
catch (MagentoFrameworkExceptionLocalizedException $e)
echo($e->getMessage());
catch (Exception $e)
echo(__('We can't send the email order right now.'));
echo($e->getMessage());
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
add a comment |
You can try this code:
$email = 'example@example.com';
$orderid = 100;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderid);
$order->setCustomerEmail($email);
if ($order)
try
$objectManager->create('MagentoSalesModelOrderNotifier')->notify($order);
echo 'You sent the order email.';
catch (MagentoFrameworkExceptionLocalizedException $e)
echo($e->getMessage());
catch (Exception $e)
echo(__('We can't send the email order right now.'));
echo($e->getMessage());
You can try this code:
$email = 'example@example.com';
$orderid = 100;
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderid);
$order->setCustomerEmail($email);
if ($order)
try
$objectManager->create('MagentoSalesModelOrderNotifier')->notify($order);
echo 'You sent the order email.';
catch (MagentoFrameworkExceptionLocalizedException $e)
echo($e->getMessage());
catch (Exception $e)
echo(__('We can't send the email order right now.'));
echo($e->getMessage());
answered Jul 8 at 13:49
KKRKKR
13010 bronze badges
13010 bronze badges
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
add a comment |
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Should avoid using object manager like this devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Dominic Xigen
Jul 8 at 17:26
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
Thank you.. : )
– Rk Rathod
Jul 9 at 8:07
add a comment |
Something like this
use MagentoSalesModelOrderEmailSenderOrderSender;
/**
* @var PsrLogLoggerInterface
*/
private $logger;
/**
* @var OrderSender
*/
private $orderSender;
/**
* @param PsrLogLoggerInterface $logger
* @param OrderSender $orderSender
*/
public function __construct(
PsrLogLoggerInterface $logger,
OrderSender $orderSender
)
$this->logger = $logger;
$this->orderSender = $orderSender;
/**
* @return void
*/
public function doStuff()
// load order however you would like
$order = [load order logic]
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
1+ for response
– Rk Rathod
Jul 9 at 8:06
add a comment |
Something like this
use MagentoSalesModelOrderEmailSenderOrderSender;
/**
* @var PsrLogLoggerInterface
*/
private $logger;
/**
* @var OrderSender
*/
private $orderSender;
/**
* @param PsrLogLoggerInterface $logger
* @param OrderSender $orderSender
*/
public function __construct(
PsrLogLoggerInterface $logger,
OrderSender $orderSender
)
$this->logger = $logger;
$this->orderSender = $orderSender;
/**
* @return void
*/
public function doStuff()
// load order however you would like
$order = [load order logic]
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
1+ for response
– Rk Rathod
Jul 9 at 8:06
add a comment |
Something like this
use MagentoSalesModelOrderEmailSenderOrderSender;
/**
* @var PsrLogLoggerInterface
*/
private $logger;
/**
* @var OrderSender
*/
private $orderSender;
/**
* @param PsrLogLoggerInterface $logger
* @param OrderSender $orderSender
*/
public function __construct(
PsrLogLoggerInterface $logger,
OrderSender $orderSender
)
$this->logger = $logger;
$this->orderSender = $orderSender;
/**
* @return void
*/
public function doStuff()
// load order however you would like
$order = [load order logic]
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
Something like this
use MagentoSalesModelOrderEmailSenderOrderSender;
/**
* @var PsrLogLoggerInterface
*/
private $logger;
/**
* @var OrderSender
*/
private $orderSender;
/**
* @param PsrLogLoggerInterface $logger
* @param OrderSender $orderSender
*/
public function __construct(
PsrLogLoggerInterface $logger,
OrderSender $orderSender
)
$this->logger = $logger;
$this->orderSender = $orderSender;
/**
* @return void
*/
public function doStuff()
// load order however you would like
$order = [load order logic]
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
answered Jul 8 at 13:49
Dominic XigenDominic Xigen
2,8501 gold badge4 silver badges16 bronze badges
2,8501 gold badge4 silver badges16 bronze badges
1+ for response
– Rk Rathod
Jul 9 at 8:06
add a comment |
1+ for response
– Rk Rathod
Jul 9 at 8:06
1+ for response
– Rk Rathod
Jul 9 at 8:06
1+ for response
– Rk Rathod
Jul 9 at 8:06
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281224%2fsend-order-email-programmatically-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown