Anshu & Jugal's answers are definitely the official way to do things, but there's also a popular method for people who use composer for integrating Magento. If the file you want to modify is within the composer vendor/ directory then you can use a package called cweagans/composer-patches to create patches on specific files.
The benefit of this method is ...
You can edit following file:
In above file, you already having order Id i.e $this->getOrderId()
based on Id you can get Order total like:
$orderId = $this->getOrderId();
$order = Mage::getModel("sales/order")->loadByIncrementId($orderId); // load order
$total = $order->...
I have faced the same error with Mageplaza extension and the solution is:
Either turn on less secure apps https://myaccount.google.com/u/1/lesssecureapps?pageId=none
OR use an application password instead of your Gmail account password https://support.google.com/mail/answer/185833?hl=en
and don't forget to flush the Magento cache after updating the ...