IspConfig With Sendgrid smtp relay

Discussion in 'General' started by Jose Pertuz, Oct 3, 2023.

  1. Jose Pertuz

    Jose Pertuz New Member

    Some cloud providers do not enable SMTP sending permission, Amazon forces you to use SES, in DigitalOcean to use Sendgrid. In my case you can make it work with sendgrid
    Postfix: main.cf add

    smtp_sasl_auth_enable = yes
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous
    smtp_tls_security_level = encrypt
    header_size_limit = 4096000
    relayhost = [smtp.sendgrid.net]:587

    Ref: API KEY https://docs.sendgrid.com/for-developers/sending-email/postfix

    Once the account has been verified with sendgrid and testing sending the message through the console. We proceed to configure roundube to use TLS on port 587

    /etc/roundcube/config.inc.php

    $config['smtp_server'] = 'tls://%h'; #edit for tls
    $config['smtp_port'] = 587;
    $config['smtp_user'] = '%u';
    $config['smtp_pass'] = '%p';

    #NEW ADD:
    $config['smtp_auth_type'] = 'LOGIN';
    $config['smtp_conn_options'] = [
    'ssl' => [
    'verify_peer' => true,
    'verify_depth' => 3,
    'peer_name' => 'cpanel.isp.link',
    'cafile' => '/etc/ssl/certs/ca-certificates.crt'
    ],
    ];

    With the above, I started sending email through Rouncube. For mobile SMTP there are no modifications, it works the same.
    Remember that when registering your domain and account in Sendgrid, you will be required to create CNAMEs in DNS in order to function properly.

    For SES (AWS) It's similar. very similar.


    Debian 12
    IspConfig 3.2.11
     
    Last edited: Oct 3, 2023
    ahrasis likes this.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Instead of configuring this manually in postfix, which might get overridden when you change settings in ISPConfig or update it, use the SMTP relay settings in ISPConfig under System > server config > mail to configure your mail relay. There is no need to manually configure RoundCube as RoundCube uses the local postfix instance for sending and when postfix is configured to relay emails, then emails from RoundCube get relayed as well automatically.
     
    ahrasis likes this.

Share This Page