简体   繁体   中英

Magento Newsletter queue does not sent any email

Magento newsletter queue does not send any email to subscribers. I saved newsletter template in queue for 2 days. But newsletters are not being sent. What could be the problem. After I have manually run this command "php bin/magento cron:run", it changes status "Not Sent" to "Sent" but any email is received by subscribers. How can i fix it? Please help me.

Please follow these below steps:

1- Check if Magento cron is running by looking into the cron_schedule table. There should be resent records for the newsletter queue listed in the table and the status of the module execution.

2- Run cron service manually by pointing your browser to http://your.magento.url.here/cron.php

3- Enable PHP mail log: http://php.net/manual/en/mail.configuration.php#ini.mail.log

4- Check outgoing mail queue on the server with mailq command

5- Try to send all mail via external mail server by installing one of the SMTP extensions: http://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html

6- Ensure that newsletter messages are not ending up in Spam folders.

Thank you for your kindly reply. Now,I can send Magento Newsletters by using cron schedule module of mageplaza. Cron schdule module run manually the newsletter template. So Updated subscribers is not sent any mail. I set up cron job in linux using "crontab -e" command:

          • /usr/bin/php /var/www/html/magento/vendor/magento/module-newsletter/Model/Observer.php

and My Observer.php file is as below:

<?php

/**

  • Copyright © Magento, Inc. All rights reserved.
  • See COPYING.txt for license details. */

declare(strict_types=1);

namespace Magento\Newsletter\Model;

use Magento\Newsletter\Model\ResourceModel\Queue\Collection; use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory;

/**

  • Newsletter module observer

  • @SuppressWarnings(PHPMD.LongVariable) / class Observer { / *

    • Number of queue */ private const COUNT_OF_QUEUE = 3;

    /**

    • Number of subscriptions */ private const COUNT_OF_SUBSCRIPTIONS = 20;

    /**

    • First page in collection */ private const FIRST_PAGE = 1;

    /**

    • Queue collection factory
    • @var CollectionFactory */ protected $_queueCollectionFactory;

    /**

    • Construct
    • @param CollectionFactory $queueCollectionFactory */ public function __construct( CollectionFactory $queueCollectionFactory ) { $this->_queueCollectionFactory = $queueCollectionFactory; $this->scheduledSend(); }

    /**

    • Scheduled send handler

    • @return void / public function scheduledSend() { / * @var Collection $collection */ $collection = $this->_queueCollectionFactory->create(); $collection->setPageSize(self::COUNT_OF_QUEUE) ->setCurPage(self::FIRST_PAGE)->addOnlyForSendingFilter()->load();

      $collection->walk('sendPerSubscriber', [self::COUNT_OF_SUBSCRIPTIONS]); } }

I want to automatically sent newsletters in magento. What is wrong in my files? Please guide me...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM