Closed nafees1988 closed 4 years ago
We have installed MagePal SMTP extension and it was working fine, now when we test it by sending a test email it shows the success message but not receiving the email also no other emails working on our magento 2 sotre. Can you please advise on what can be the issue?
Emails working when we disable the extension.
Hi, When i disable this module i'm getting "Unable to send mail: Unknown error" when submit any contact form. Please advice me.
Thanks
Since I have zero information on what version of our extension you are using or what version of Magento you are using it is next to impossible to even try to offer help.
You will need to do some debugging, that error message seems to trigger from vendor/zendframework/zend-mail/src/Transport/Sendmail.php line 290
Hi, I'm using magento 2.3.3 and MagePal_GmailSmtpApp v2.6.8. Can you please advice ASAP, because my website is on live.
Hello. I have a query. We have installed MagePal SMTP extension and it was working fine, now when we test it by sending a test email it shows the success message and Test Message has been transported. So I had maken other email template and I had tried custom email action. But not receiving the email. At that time success send message is shown in Magento Admin Page. If I had checked gmail, but mail was not come in. I am going to send my custom email. Server setting is follow.
Controller/EmailAction.php
public function execute()
{
$data = $this->getRequest()->getParams();
$this->customerRepository = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Customer\Api\CustomerRepositoryInterface');
$this->transportBuilder = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Mail\Template\TransportBuilder');
$this->scopeConfig = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\App\Config\ScopeConfigInterface');
$this->storeManager = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Store\Model\StoreManagerInterface');
$this->inlineTranslation = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\Translate\Inline\StateInterface');
if ($data) {
try {
//get template by id
$objectManager = \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Email\Model\Template');
$template = $objectManager->load($data['template_id'])->toArray();
// get order
$collection = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Sales\Model\ResourceModel\Order\CollectionFactory')->create();
$collection->getSelect()->where('main_table.entity_id ='.$data['order_id']);
$order = $collection->load()->toArray()['items'][0];
//get order_meisai
$order_meisai = $this->getOrderProductInfo($this->_getProduct($data['order_id']));
// get sender
$collection = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\User\Model\ResourceModel\User\CollectionFactory')->create();
$collection->getSelect()->where('main_table.user_id ='.$data['sender']);
$user = $collection->load()->toArray()['items'][0];
// get customer
$customer = $this->customerRepository->getById($data['customer_id']);
$templateParams =
[
'customer_name' => $data['customer_name'],
'order_num' => $order['increment_id'],
'order_meisai' => $order_meisai,
];
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
$this->inlineTranslation->suspend();
$transport = $this->transportBuilder
->setTemplateIdentifier(
$template['orig_template_code']
)
->setTemplateOptions(
[
'area' => \Magento\Framework\App\Area::AREA_ADMINHTML,
'store' => $this->storeManager->getStore()->getId(),
])
->setTemplateVars($templateParams)
->setFrom(
[
'name' => $user['username'],
'email' => $user['email']
])
->addTo($customer->getEmail())
->getTransport();
$transport->sendMessage();
$this->inlineTranslation->resume();
$this->messageManager->addSuccess(__('Success send mail.'));
} catch (\Exception $e) {
$this->messageManager->addException($e, __('We can\'t send mail now.'));
$this->_redirect('**************', ['order_id' => $data['order_id']]);
return;
}
}
$this->_redirect('*************', ['order_id' => $data['order_id']]);
}
If I have run above code, then Success send mail message is shown but if I check gmail, the mail hasn't come in. Magento version is 2.4.5 and MagePal SMTP extension version is v2.9.0 .
Can you please advise on what can be the issue?
Magento version #:
Edition (EE, CE, OS, etc):
Expected behavior:
Actual behavior:
Steps to reproduce:
Preconditions