Skip to content

Instantly share code, notes, and snippets.

pmta delete -queue=*/*
pmta delete -queue=hotmail.com/*
smtp-listener 1.2.3.4:465 tls=yes
smtp-server-tls-certificate /etc/pmta/certificate-generated-by-openssl.pem "YourPasswordHere" smtp-server-tls-ciphers "HIGH:MEDIUM:!ADH:@STRENGTH"
<source 0/0> # matches all
allow-starttls yes
require-starttls-before-auth yes
allow-unencrypted-plain-auth no
</source>
@juhniorsantos
juhniorsantos / get_spam_score.php
Created May 24, 2024 20:31 — forked from neo22s/get_spam_score.php
PHPMailer Spamassassin Score
<?
/**
* Example how to use it in PHPMailer
*/
//once initiated PHPMAiler before you can get_spam_socre you need to execute preSend() since is the way to get the RAW email that will be sent.
$mail->preSend();
$spam_score = get_spam_score($mail->getSentMIMEMessage());
if ($spam_score >= 5 OR $spam_score === FALSE)

Install RabbitMQ on CentOS 7

sudo yum -y install epel-release
sudo yum -y update

Install Erlang

Download repository

STARTTLS with Let's Encrypt and PowerMTA
This is an update to my previous post. I tried using the same certificate to let PowerMTA secure our e-mail server using STARTTLS, but unfortunately, Let's Encrypt is still untrusted by our PHP front-end because Let's Encrypt is still a new certificate authority. The solution is to include IdentTrust's root certificate as it's already trusted by all clients.
This setup is specific to a server with Apache and PowerMTA. You can probably make this work without a web server. Simply adjust the paths and other things as necessary.
I'm pasting the previous steps in this post with some updates.
First, log in as root. It's supposed to be a bad practice to work directly on root, but what the heck:
# sudo su -
@juhniorsantos
juhniorsantos / nginx-tuning.md
Created November 14, 2022 21:29 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@juhniorsantos
juhniorsantos / bash.sh
Created November 9, 2020 22:06 — forked from autaut03/bash.sh
PHPBrew PHP 7.3 with extensions (incl. xdebug, pthreads, fpm) and ZTS
phpbrew install --mirror=https://www.php.net 7.3.12 +default +mysql +mb +debug +fpm +openssl=/usr/local/opt/openssl +bz2=/usr/local/opt/bzip2 +zlib=/usr/local/opt/zlib -- --enable-maintainer-zts
phpbrew ext install github:krakjoe/pthreads master
@juhniorsantos
juhniorsantos / gist:007a87de2a0d3e1d76ed9b9d05f78a62
Created November 28, 2016 13:32 — forked from maccath/gist:3981205
Split PDF to individual pages using FPDI and FPDF
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/