• SendGrid integration is currently not working. The error with every email that gets sent is: “Number of elements in “$ccEmails” can not be less than 1.”

    The reason why this is happening is in the file PostmanSendGridMailEngine.php lines 116 – 136.

    If the generated arrays $ccEmails and $bccEmails are empty, SendGrid library returns this error, because it is expecting for function (addCcs and addBcc) parameters to at least have one item in array. E.g.:

    Assert::minItems($ccEmails, 'ccEmails', 1);

    The solution is to simply check whether those arrays are empty in lines 125 and 136.

    
    if (!empty($ccEmails)) {
        $email->addCcs($ccEmails);
    }
    

    and

    
    if (!empty($bccEmails)) {
        $email->addBccs($bccEmails);
    }
    
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support M Haseeb

    (@haseeb0001)

    @nejcpenko Hi,

    Hope you are doing good.

    Let me look into it, can you share the Diagnostic Test report also.

    Thanks

    Thread Starter nejcpenko

    (@nejcpenko)

    Sure:

    Mailer: postsmtp
    HostName: domain.com
    cURL Version: 7.68.0
    OpenSSL Version: OpenSSL/1.1.1f
    OS: Linux shops 5.4.0-88-generic #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 x86_64
    PHP: Linux 7.4.3 C.UTF-8
    PHP Dependencies: iconv=Yes, spl_autoload=Yes, openssl=Yes, sockets=Yes, allow_url_fopen=Yes, mcrypt=No, zlib_encode=Yes
    WordPress: 6.0.1 sl_SI UTF-8
    WordPress Theme: customtheme
    WordPress Plugins: Advanced Custom Fields, Advanced Dynamic Pricing for WooCommerce, Contact Form 7 Image Captcha, Contact Form 7, GTM4WP, Facebook for WooCommerce, Perfect Brands for WooCommerce, Post SMTP, UberMenu 3 - The Ultimate WordPress Mega Menu, WooCommerce Cart Abandonment Recovery, MailerLite - WooCommerce integration, Payment Plugins for Stripe WooCommerce, WooCommerce Coupon Links, WooCommerce Product Stock Alert, WooCommerce, Yoast SEO, WP Rocket, Yoast Test Helper
    WordPress wp_mail Owner: /var/www/www.domain.com/releases/12/web/app/plugins/post-smtp/Postman/PostmanWpMailBinder.php
    WordPress wp_mail Filter(s): wp_staticize_emoji_for_email, PostsmtpMailer->get_mail_args
    WordPress phpmailer_init Action(s): wpcf7_phpmailer_init
    Postman: 2.1.3
    Postman Sender Domain (Envelope|Message): domain.com | domain.com
    Postman Prevent Message Sender Override (Email|Name): No | No
    Postman Active Transport: SendGrid API (https://api.sendgrid.com:443)
    Postman Active Transport Status (Ready|Connected): Yes | Yes
    Postman Deliveries (Success|Fail): 2114 | 13
    

    When can I expect this fix to be released since it’s currently blocking us from using the original plugin and has to be modified to work?

    • This reply was modified 3 years, 10 months ago by nejcpenko.
    • This reply was modified 3 years, 10 months ago by nejcpenko.
    Plugin Support M Haseeb

    (@haseeb0001)

    @nejcpenko

    Can you share the scenario of this issue? where you are getting this error? on the test email or on the contact form? please explain this issue in steps so we can reproduce this issue and fix this asap.

    Thanks

    Thread Starter nejcpenko

    (@nejcpenko)

    To reproduce jsut use SendGrid for sending emails. It does not work for any of the cases: user emails, Woocommerce emails, you can not even send a test email from the plugin as it returns the error described above.

    The code I’ve pasted above should be pretty obvious why it does not work.

    If no cc emails are set, the plugin is calling $email->addCcs($ccEmails) with an empty array. And the first line of the addCcs method in the sendgrid library has an assert check Assert::minItems($ccEmails, 'ccEmails', 1);

    This fails immediately because you are passing an empty array (0 items) for cc (or bcc) list and the email never gets sent.

    So currently the plugin (if you are using SendGrid integration) is completely broken.

    Plugin Support M Haseeb

    (@haseeb0001)

    @nejcpenko
    Thanks for your response, let me reproduce it and get back to you soon with updates.

    Thread Starter nejcpenko

    (@nejcpenko)

    any updates here?

    Plugin Support M Haseeb

    (@haseeb0001)

    @nejcpenko

    I reproduced the same issue i.e. Send Grid with WooCommerce emails. No issues are reported on my side. see the video here.

    Thanks

    Thread Starter nejcpenko

    (@nejcpenko)

    Any chance you can re-upload the video please? This still not works, and it is clear to me why it doesn’t from the code. Can you please check if in your tests you have cc and bcc emails setup in the plugin Settings -> Message?

    Plugin Support M Haseeb

    (@haseeb0001)

    @nejcpenko Here is the video link and let me check.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘SendGrid integration not working’ is closed to new replies.