PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label nopcommerce. Show all posts
Showing posts with label nopcommerce. Show all posts

Thursday, November 10, 2022

[FIXED] How to authenticate emails to prevent gmail mark it as spam

 November 10, 2022     asp.net, dkim, email, nopcommerce     No comments   

Issue

We just open a new e-commerce website and recently noticed Gmail treat our e-mails as spam (notice the red question mark). Our website run behind CloudFlare so the email server IP address is different than the domain.

SPAM marked notice the question mark

We also did not send a bulk email at least not yet. There are some explanations in Google FAQ but not sure what it means or how I need to implement it. Can you please explain how to set these DKIM (preferred) or SPF.

Our website uses nopcommerce (3.70) and developed with ASP.Net.


Solution

Disclaimer: I'm not a "pro" at these things (more later):

  • IMHO, this is probably the simplest explanation of DKIM

  • SPF: in my own words: providing a DNS TXT record that identifies "where" all your emails (smtp/mta servers) can come from. The more complete/formal spec is here

  • You can implement both


Opinionated:

  • SPF is easier to implement

    • identify all the origins of your email, set them in your SPF record, which is a TXT record in DNS
  • DKIM: is more complex - your mail/smtp server/s must implement it.

    As a "web developer" one can see how this would be done in ASP.Net/C#/VB - e.g. sign some payload and using HttClient send some signature in an HTTP header in some outbound request.

    But this is done on an SMTP server, so unless you have one that already implements it, it's something you'll have to do...

IMHO, for DKIM, unless your SMTP/MTA implements it, I'd go for services that provide it. There are 2 types:

  • Transactional email services:

    Not for bulk email. These are the usual "order confirmation" emails, standard support/customer service, etc. emails. They will likely have APIs for you to implement (e.g. sending your MailMessage using thier servers and/or constructing something that equates to it and send that "object" to their API).

  • Bulk email services

    these providers will already have implementations because one of their core value propositions is "deliverability" of your bulk/marketing emails. They should (of course do your due diligence) have both implementations inherently. Will also have their own APIs for bulk email context.

Hth



Answered By - EdSF
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, July 3, 2022

[FIXED] How do I pass the correct details into the PayPal email “Shipping details” field using Payments PayPalStandard Plugin?

 July 03, 2022     nopcommerce, paypal     No comments   

Issue

When I process my shopping Cart, I am passing all the desired information to PayPal that relates the the purchase and user address. I am also allowing the User to choose to either Ship the purchase via UPS or to pick-up the purchase from one of our satellite locations. Therefore, If the User chose UPS, I would like the "Shipping Details" field to state UPS in the Email that PayPal sends to my Store Manager. However, if the User selected to pick-up the purchase, I would like to show the Pick-Up location Name under the "Shipping Details" field.

Currently, the Shipping Details field is displaying "Air Service" for all purchases, which does not make any sense or is useless to us as a piece of information to process the User purchase on our side.

Within the nopCommerce PayPal Standards Plugin, I am providing all the necessary information that is needed to process the purchase once Payment has been made via PayPal. I tried providing the "shipping_method" to fill that "Shipping Details" field but nothing changes in the Email report that we receive.

...

        //create query parameters
        return new Dictionary<string, string>
        {
            //PayPal ID or an email address associated with your PayPal account
            ["business"] = _payPalStandardPaymentSettings.BusinessEmail,

            //shipping method
            ["shipping_method"] = shippingMethod,

            //the character set and character encoding
            ["charset"] = "utf-8",

            //set return method to "2" (the customer redirected to the return URL by using the POST method, and all payment variables are included)
            ["rm"] = "2",

            ["bn"] = PayPalHelper.NopCommercePartnerCode,
            ["currency_code"] = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId)?.CurrencyCode,

            //order identifier
            ["invoice"] = postProcessPaymentRequest.Order.CustomOrderNumber,
            ["custom"] = postProcessPaymentRequest.Order.OrderGuid.ToString(),

            //PDT, IPN and cancel URL
            ["return"] = $"{storeLocation}Plugins/PaymentPayPalStandard/PDTHandler",
            ["notify_url"] = $"{storeLocation}Plugins/PaymentPayPalStandard/IPNHandler",
            ["cancel_return"] = $"{storeLocation}Plugins/PaymentPayPalStandard/CancelOrder",

            //shipping address, if exists
            ["no_shipping"] = postProcessPaymentRequest.Order.ShippingStatus == ShippingStatus.ShippingNotRequired ? "1" : "2",
            ["address_override"] = postProcessPaymentRequest.Order.ShippingStatus == ShippingStatus.ShippingNotRequired ? "0" : "1",
            ["first_name"] = orderAddress?.FirstName,
            ["last_name"] = orderAddress?.LastName,
            ["address1"] = orderAddress?.Address1,
            ["address2"] = orderAddress?.Address2,
            ["city"] = orderAddress?.City,
            ["state"] = orderAddress?.StateProvince?.Abbreviation,
            ["country"] = orderAddress?.Country?.TwoLetterIsoCode,
            ["zip"] = orderAddress?.ZipPostalCode,
            ["email"] = orderAddress?.Email
        };

...

How do I make sure that the Shipping method, such as UPS or Pick-Up Location name is displayed under the "Shipping Details" field in the PayPal Receipt that the Store Manager receives?

Currently, we are getting a useless value of "Air Service", as indicated in the below image, which is not something that we provide for Shipping.

PayPal Receipt
(source: ulsprouts.com)


Solution

shipping_details is not a valid parameter available with PayPal Standard. It's actually quite limited when it comes to shipping details.

What I would recommend for you is to build your own email notifications with the use of Instant Payment Notification (IPN).

This will trigger a POST of all transaction data to a script that you have sitting on your server. You can receive this data, and process it however you need. Within that script you would have access to all of the IPN data, and you could also pull any data you needed back out of your nopCommerce system. With all of the data needed available, you can then build your own custom branded email notifications, and have them sent accordingly.

For example, the Invoice ID is getting passed to PayPal, which would then come back in the IPN data. As such, you could query your database to pull out all the shipping details, and build your email that way.



Answered By - Drew Angell
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing