Sending Emails inline & solving the issue of not able to send Emails in Magento
To deliver the emails on Magento, you will require having an SMTP server and setting up a campaign for a smooth run. However, you can encounter problems relating to the delivery of emails on Magento. It can be the same as the ones that are linked to Gmail, Hotmail, etc.
- After registering with the Magento community store, it sends event emails in every section event in more than one number or multiple.
- The activities that are run through CRON are needed to be performed twice in action.
- After the order is done, two confirmation emails are received for the order in the Magento store.
- The order confirmation email is not received by the customer’s end.
We will surely proceed towards the troubleshooting of Magento emails that are not being sent. But before we do that, let us inform you about the respective SMTP setting in Magento for the delivery of email templates.
The process of delivering emails through Magento –
Setting SMTP with Magento:-
Verify the user name and the passwords
As you log-in to Magento, click on the following in the same order –
Systems -> Advanced -> System -> Mail Sending Setting.
Enter the SMTP server name or choose the major ones from the drop-down list. After that, select the SMTP port, which will be 25 by default (ex- you can also choose other options as well).
Select and copy – local file app/core/code/Model/Template.php/Email/Mage.
After selecting and copying the file, you need to enable the Module.
The last step will be to open the Template.php and follow the function to change the getMail():
public function getMail()
{
if (is_null($this->_mail)) {
/* changes begin */
$my_smtp_host = Mage::getStoreConfig(‘system/smtp/host’);
$my_smtp_port = Mage::getStoreConfig(‘system/smtp/port’);
$config = array(
‘port’ => $my_smtp_port, ‘auth’ => ‘login’,
‘username’ => ’email@domain.com’,
‘password’ => ‘yourpassword’ );
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail(‘utf-8’);
}
return $this->_mail;
}
Thus, now you will be able to send emails in Magento.
Troubleshooting process – Magneto Email not sending issue!
To know if the email was sent or not, you can check it through the information area below the order number. If it shows that the email has been sent, but you are not receiving the email back, then more likely, the problem is with the Magento email setting or its server.
First, you need to look through the setting and see whether it’s on or not.
Check Admin -> Configuration -> Advanced -> System -> SMTP Settings. It will ensure that your emails are not disabled.
Check Admin -> Configuration -> General -> Store Email Address. Look for the email address that should be correct. If the email address is incorrect, then it is obvious that you won’t be able to send or receive any email through the server.
Check if there has been any extension used to send emails by Magento. You can run the PHP script on port 587 to know an easy way of connecting ‘smtp.gmail.com.’ It will be shown in your root Magento directory. Other ports can replace the port that you have applied to test the access. If you are still getting the error, then you must consult your serving company to get the issue resolved.
Check System => Configuration => Sales Emails => Shipment Comments into the Magento admin. Here, you need to look if the email sending option is enabled for the dispatch.
To send out the emails in Magento, the use of a local PHP or SMTP mail server is more common. It is also seen in Magento that most of the emails that are not sent are due to the structure that does not suit the email requirement. That’s the reason they might get refused by the server to be sent through further.
Go through the server and check if it is able to support the sending option of the emails. It can also be feasible even if Magento is not using any extension for sending emails.
Once you have checked all the above issues, you can also look through the extension logs and search for the error. Here, you need to look for the order’s errors or if there is any mail or warning. The log will surely give you an indication if there prevails any problem in that section.
The next important step is to look through your server’s email log. It will show if the email has actually been sent or not. You can check it from – at/var/log/maillog as per the software of mail that you are using on your system.
The one thing that you need to be sure of is the proper installation of the Magento server. Its configuration should be correct for the sending of emails and other needs. Thus, the above-given information/procedure will help you in troubleshooting the problem of sending emails in Magento.
We will be discussing one major issue that relates to the Magneto emails that are not being sent and its troubleshooting –
Issue:–
There are multiple event emails that Magento sends for every section event. For example – if a customer registers on the Magento community store, then he/she will receive two emails for the confirmation of account.
When a customer places the order, there are two confirmation emails received by the Magento store.
If an activity is run via CRON, then the action is performed twice in a row.
Analysis:-
The work of Magento involves the action of the CRON event and overriding the action function. Under this action, both core/override function is being run. Thus, the problem will occur due to the continuous running of the core function and override function method in Magento.
After getting into the depth, it was concluded that the problem mainly occurs in Magento community version 1.9.2.1. However, the version may not be specific and may come under the lower version of Magento.
Solution:-
The SMTP pro extension is added.
Furthermore, your issue is resolved, and now you will receive one email per order. It will be displayed as following using the Magento SMTP Pro Extension –
If you face any issue relating to the above-given solution, you can contact us or hire freelance magento developer and get the query resolved as per your need.