Postfix – how to retry delivery of mail in queue?

According to postqueue(1) you can simply run postqueue -f to flush your mail queue. If the mails aren’t delivered after flushing the queue but are being requeued instead, you might want to check your mail logs for errors. Taking a peek at postsuper(1) might also be helpful. Maybe the messages are on hold and need … Read more

How do I get apt-get to ignore some dependencies?

Simple and easy solution: just specify the unwanted packages with an extra – after each of them. Example without the – switch: root@debian:~# apt-get install bsd-mailx Reading package lists… Done Building dependency tree Reading state information… Done The following extra packages will be installed: exim4-base exim4-config exim4-daemon-light liblockfile-bin liblockfile1 […] Example using the switch to … Read more

WordPress: Add custom add_filter for custom functions

You can use the apply_filters function: function koku_crm_send_sendgrid($sendgrid_api_key, $to, $subject, $text, $html) { $to = apply_filters( ‘koku_crm_send_to’, $to ); $sendgrid = new \SendGrid($sendgrid_api_key); $mail = new KCSendGrid\Mail(); $from = new KCSendGrid\Email(get_bloginfo( ‘name’ ), get_bloginfo( ‘admin_email’ )); $mail->setFrom($from); $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, ‘UTF-8’)); $content = new KCSendGrid\Content(“text/plain”, $text); $mail->addContent($content); $content = new KCSendGrid\Content(“text/html”, $html); $mail->addContent($content); $personalization = new … Read more

Attach a external file as attachement using wp_mail

You can’t attach from a URL. So https://ucarecdn.com/8aa17c61-bd55-4311-8b45-7d9a2efde6c5/ won’t work. You need an absolute path to the file, such as /path/to/my/file.ext. But there are some other problems with your code snippet as well. You use $email_attachement (with a ..chement…) in one place, but then $email_attachment in your wp_mail() call. Also, your “attachment” isn’t a file. … Read more

Send email with list of active plugins upon activation/deactivation

If you look here in /wp-admin/includes/plugin.php do_action( ‘deactivated_plugin’, $plugin, $network_deactivating ); } } if ( $do_blog ) update_option(‘active_plugins’, $current); if ( $do_network ) update_site_option( ‘active_sitewide_plugins’, $network_current ); The options aren’t updated until after the hook fires. You can get around this by using the first parameter to deactivated_plugin: function detect_plugin_change( $plugin, $network_activation ) { $url … Read more

Send admin new order email to logged in user as well

What you have makes sense, except that your variable names dont match. You have $object in your function definition and in the function code you are trying to use $order. Adjusted: /* SEND ADMIN E-MAIL TO LOGGED IN USER */ /* — */ add_filter( ‘woocommerce_email_recipient_new_order’, ‘your_email_recipient_filter_function’, 10, 2); /* Add parents e-mail address to new … Read more