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!