The problem happens only if you use express checkout and do not fill in any address before going to paypal. Order is created before redirecting to paypal site, so that it could be maintained after user returns from paypal. At the time of order creation interceptor sends emails, but if there is no address, there is no way to send email.
If you would use normal checkout and select paypal as payment option, everything would be fine.
As solution for this situation i think its better to send email manually to user after returning from paypal. Then address is created and taken from paypal returned options.
Another approach could be to create system job that periodically checks orders and sends emails based on created date and orders status.
Example added send email in PaypalExpressSuccess
Ch.RunWorkflow("ShoppingCartCheckoutWorkflow", order);
Ch.OrderRepository.UnitOfWork.Commit();
//Send email
var recipientAddress = order.OrderAddresses.FirstOrDefault(oa => oa.OrderAddressId == order.AddressId);
if (recipientAddress != null)
{
IDictionary<string, object> context = new Dictionary<string, object> { { "order", order } };
UserHelper.SendEmail(context, recipientAddress.Email, "order-confirmation");
}
return RedirectToAction("ProcessCheckout", "Checkout",
new {id = order.OrderGroupId});
It is now included in our new release. Checkout this commit
https://github.com/VirtoCommerce/vc-community/commit/7c8bc663da2023a3796bee6a42f2a2b36e1dfb22