2

we are not getting order confirmation email if customer placed an order through paypal.but we get invoice and shipment mails.

we set Sale : Payment Action in paypal configuration.

so once we create the order, along with the order email [its not going to customer] i want to send invoice mail also to customer. i think this extension will send invoice only once order status become complete.

if we use SMTP extension will it work for us ?

is there any thing else we need to do ?

Edit

also I want to know is Email will send only if we pay money and succesfully return to site ? If we just click on "place order" & redirect to paypal page, will it not send email ?

2016-06-13T20:15:10+00:00 ERR (3): 
exception 'Mage_Paypal_UnavailableException' with message 'Empty response.' in /home/site/public_html/app/code/core/Mage/Paypal/Model/Ipn.php:166
Stack trace:
#0 /home/site/public_html/app/code/core/Mage/Paypal/Model/Ipn.php(116): Mage_Paypal_Model_Ipn->_postBack(Object(Varien_Http_Adapter_Curl))
#1 /home/site/public_html/app/code/core/Mage/Paypal/controllers/IpnController.php(43): Mage_Paypal_Model_Ipn->processIpnRequest(Array, Object(Varien_Http_Adapter_Curl))
#2 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_IpnController->indexAction()
#3 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#4 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#5 /home/site/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#6 /home/site/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /home/site/public_html/index.php(87): Mage::run('', 'store')
#8 {main}
12
  • If I choose other payment method then mails were sent ?? Jun 9, 2016 at 4:46
  • @murtuza yes, for all other payment method , order confirmation mail will send immediately. Jun 9, 2016 at 5:22
  • Have you configure the cron.sh file in your cpanel or crontab Jun 9, 2016 at 5:26
  • @murtuza yes, cron is working. will it be a cron job is reason for this ? because for other payment methods we are getting email. Jun 9, 2016 at 5:30
  • Might be possible if mail were added to queue programmatically then cron job may have issue Jun 9, 2016 at 5:34

8 Answers 8

5
+50

Concepts

we are not getting order confirmation email if customer placed an order through paypal.but we get invoice and shipment mails.

This clarifies one thing: that your email sending mechanism (likely the Magento cron) is working correctly in general.

if we use SMTP extension will it work for us ?

Whether you implement this extension or not, it will not affect whether your PayPal order emails work. This module is designed to sit in the background and take the regular email send jobs from the core Magento mail module and do its own thing with them. You will not notice a difference in regular Magento use from installing it, other than an email log table in Magento admin which contains a history of your sent emails.

If you have installed this extension, you could use that email log in Magento admin to check what has been sent. You can access it via System -> Tools -> SMTP Pro - Email Log.

also I want to know is Email will send only if we pay money and succesfully return to site ? If we just click on "place order" & redirect to paypal page, will it not send email ?

Emails are sent when certain status changes occur on various models in Magento. Order emails are sent when an order reaches the processing status, which means it has been invoiced and paid (payment method has been charged [capture() method]). Invoice emails are sent when the order's invoice is created (normally/often when the order is created as well). Shipment emails are created when a shipment is created for an order, etc...

Yes - the email will send only if you've completed the PayPal transaction and successfully returned to your Magento site (and Magento has successfully registered that payment against the order and saved it).

If you just click on "place order" & redirect to PayPal page, it will not trigger any emails to be sent. Your order doesn't exist at this point, it is simply a quote waiting to be converted to an order when the customer returns from PayPal.

The code

If you take a look at Mage_Paypal_Model_Express_Checkout::place() as an example, you will see the following conditions apply to when Magento will send (queue) a new order email. This method is triggered when customers return from PayPal (the returnAction in Mage_Paypal_Controller_Express_Abstract sends them here via ->placeOrderAction() then $this->_checkout->place()):

# File: app/code/core/Mage/Paypal/Model/Express/Checkout.php
switch ($order->getState()) {
    // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
    case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
        // TODO
        break;
    // regular placement, when everything is ok
    case Mage_Sales_Model_Order::STATE_PROCESSING:
    case Mage_Sales_Model_Order::STATE_COMPLETE:
    case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
        $order->queueNewOrderEmail();
        break;
}

Essentially the email will be sent (queued) if the new order's state is either "processing", "complete" or "payment_review" - have you checked the affected PayPal orders to see what their status is? You say you can ship them, so I assume that they're "processing".

The one exception as you can see above is when the state of the new order is "pending payment". The comment from the Magento developers explains it, but it can happen in a delayed payment situation. I would suggest that this is not very common.

Of course, that switch statement is specific and doesn't contain a default case (side note: this breaks the Zend style guidelines, but so does a lot of the core Magento code!). This means that if the order state is not any of the ones mentioned, the order will also not be sent (queued).


Where to from here?

I'd suggest you do the following:

  • Get a PayPal sandbox account set up in your development environment so you can test it yourself!
  • Inspect the status of new PayPal orders as they come in. Look at the status of the orders. Look at the history of the order to see if anything seems out of the ordinary. Try changing the email on one of the orders to yours and triggering the order email to be re-sent manually from the order view screen in Magento admin (this will eliminate the email template itself as an issue)
  • Enable PayPal logging, and inspect the API logs as the requests are made (best done in a development environment, assuming you can reproduce it)

Notes

The comments/suggestions I've made above assume that you don't have any third-party or custom made modules getting in the way of any of the orders or payments processes in Magento. If you do, you should mention them!

Good luck, hope this helps!

10
  • Fantastic, Thanks for spoon feeding me. Complete , perFect answer. i already set up sandbox account and used some dummy credit cards, but no cards are accepting in payment gateway. if possible will try with real payment and let you know. I repeat World need Devolopers like you. Jun 9, 2016 at 20:57
  • @user9999 It's not spoon feeding - you asked questions and the community tries their best to answer them! I'd suggest you persist with your PayPal sandbox setup. You need an accurate development environment to test things on - you shouldn't need to test things in production!
    – scrowler
    Jun 9, 2016 at 20:58
  • you are absolutely right. i will let you know once i done. Jun 9, 2016 at 21:10
  • in both sandbox & live mode , after successull transaction, than also its showing pening payment as order status. its not converting as processing i followed link1 , liink2 but it did't worked for me. Jun 13, 2016 at 19:57
  • 1
    but 7 a.m there :-) Jul 28, 2016 at 18:52
2

Form Magento1.9 Order mail send via cron job .

But You can overcome using this simple free Extension, install this extension they will give you option make e-mail in queue or not

https://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html

For Paypal Mail, complete your transaction after that you will get the mail

6
  • You are always welcome Jun 10, 2016 at 5:41
  • If this answer solved your problem then please accept this answer. Jun 10, 2016 at 5:43
  • sure, i will do that. Jun 10, 2016 at 5:44
  • Have you get the solution or not? Jun 11, 2016 at 9:12
  • Please try my answer above posted... Jun 11, 2016 at 9:44
1

You might need to disable SSL verification, under the

System > Configuration > Payment methods > Paypal > Advanced settings > Enable SSL verification
3
  • we tried it, but it did't worked for us. May 25, 2016 at 5:16
  • i wanted to know is Email will send only if we pay money and succesfully return to site ? If we just click on "place order" & redirect to paypal page, will it not send email ? Jun 9, 2016 at 12:09
  • Try My solution Jun 11, 2016 at 9:46
1

I hope your cron working properly as magento sends confirmation mails on cron job. see this http://www.aschroder.com/2015/01/sending-emails-by-queue-in-magento-1-9-1/ and check if your emails being stored in core_email_queue and core_email_queue_recipients.

6
  • 2
    but for other payment methods , it will send order confirmation email immediately. Jun 8, 2016 at 13:04
  • Did you check your the tables if your email is being recorded in that. There ma be a chance due any errors(related to paypal,network delay etc.) magento may not be recording in them.Are you getting any errors in system and exception logs?
    – Bharath
    Jun 8, 2016 at 13:08
  • which table i need to check for email is storing or not related to paypal. Jun 8, 2016 at 13:11
  • Check these tables ' core_email_queue' and 'core_email_queue_recipients'
    – Bharath
    Jun 8, 2016 at 13:12
  • i will check and inform you. Jun 8, 2016 at 13:17
1

The real problem was some unaffected files. as some files of sites was attacked by hackers, our hosting team blocked some ports [80 or some other ports ] , after we deletd those those files, hosting team unblocked those ports , than emails are going like anything.....

0

You should check your paypal configuration on your paypal account https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/ https://lastdropofink.co.uk/tools/magento/magento-paypal-ipn/

5
  • i will check it, i wanted to know is Email will send only if we pay money and succesfully return to site ? If we just click on "place order" & redirect to paypal page, will it not send email ? Jun 9, 2016 at 12:05
  • if the client didn't succesfully paid no email is sent because the ipn notification will not be sent, but if it pays even though doesn't return to your website, paypal will send the ipn notification to your magento store (if properly configured) and put the order in processing sending also the confirmation email to the client.
    – springerin
    Jun 9, 2016 at 12:07
  • okay, i am trying to pay using sandbox account with demo credit cards. but paypal payment page is not accepting any of the credit cards. if you have any working test credit card for paypal, please tell me. Jun 9, 2016 at 12:12
  • yes, had same issue and don't remember if i found one but you can pay with a sandbox account as a paypal member and that works for sure and so test the notification process
    – springerin
    Jun 9, 2016 at 12:19
  • i followed those links, but it did worked for me. Jun 13, 2016 at 20:12
0

Here is the Latest Solution

Please try and le me know- check my blog

http://www.anupchaudhary.com/2016/06/solved-paypal-automated-order.html

OR

You need to add some code in

app/design/frontend/base/default/template/checkout/success.phtml

    <?php 
    $order = Mage::getModel('sales/order');
    $customer = Mage::getSingleton('customer/session')->getCustomer();
    $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
    $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
    $countryCode = $order->getShippingAddress()->getCountry();
    if($countryCode!='IN')
    {
               if($order['status']=='payment_complete')
               {
                                     try
                                    {
                                        $order->sendNewOrderEmail();
                                    }
                                    catch (Exception $ex)
                                    {
                                        echo "Email Not Sent...";
                                    }
                            $customer = Mage::getSingleton('customer/session')->getCustomer();
                            $email = $customer->getEmail();//End Email Sending
               }
   }?>
4
  • you really should not make any modification in app/design/frontend/base/default/, you need to copy .phtml file into your package default theme.
    – electroid
    Jun 11, 2016 at 11:45
  • Ok then copy, it will work Jun 11, 2016 at 13:40
  • @AnupChaudhary sorry it didt worked for me , i added like here Jun 13, 2016 at 20:10
  • Your country is India? I aaded the code for India Jun 14, 2016 at 4:01
0

I had the same problem and it was caused by magento core bug.

In my exception.log file I had the following error:

main.CRITICAL: Notice: Array to string conversion in /home/mywebsite/public_html/var/view_preprocessed/pub/static/vendor/magento/module-payment/view/frontend/templates/info/default.phtml on line 1

If you want to fix it, create your own version of file vendor/magento/module-payment/view/frontend/templates/info/default.pthml in your theme and change line:

<th scope="row"><?= $block->escapeHtml($label) ?></th>

to:

<td>
    <?php 
    $x = $block->getValueAsArray($value, true); 
    if(is_array($x)){
        //print_r($x);
        foreach($x as $y){
            echo $y;
        }
    }else{
        echo $x;
    }
    ?>
</td>

It's a very basic fix but it worked on my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.