4.2.1.6. Setting up mail in Vesta

  1. Switch to tab "MAIL" and click on the green button "+":
  2. Specify the domain used for mail, set the required parameters and click "Add" ("Add"):
    • "Domain" ("Domain") - specify a domain for the subsequent creation of mailboxes in it.
    • "Antispam support" ("Antispam Support") - check the box to configure scanning of all messages for spam.
    • "Antivirus support" ("Antivirus Support") - check the box to configure scanning of all messages for viruses.
    • "DKIM support" ("DKIM Support") — check the box to configure DKIM.
      DKIM support is installed automatically if the DNS system the domain of the same name was added to VestaCP. Otherwise, you need additional get public DKIM key.
  3. After creating the mail domain, click on the button "Back" or go to the menu "MAIL" from the first item and move the cursor over it and click on the button "ADD ACCOUNT":
  4. In the displayed page, you need to fill in the data for the created mailbox and write down the connection data to it:
    • "Domain" ("Domain")
    • "Account" ("Account")
    • "Password" ("Password")
    • "Send account details to" ("Send login credentials to email address")
    • All data for further connection will be displayed on the same page in an additional block. Description of the block with access data located on the right:
      • "Account" ("Username") — login that will be used for authorization.
      • "Password" ("Password") is the password that will be used for authorization.
      • "IMAP hostname" — server address for the IMAP protocol. You can use its IP address as the server address.
      • "IMAP port" — port used for IMAP connection.
      • "IMAP security" — Encryption type for the IMAP protocol.
      • "IMAP auth method" — authorization method.
      • "SMTP hostname" — server address for the SMTP protocol. You can use its IP address as the server address.
      • "SMTP port" — port used for connection via SMTP protocol.
      • "SMTP security" — Encryption type for the SMTP protocol.
      • "SMTP auth method" — authorization method.
      • "Webmail URL" — address of the Web mail client. AT URL you can use the server IP address instead of the specified domain.
    • Click on the button "Add" ("Add") after successfully filling in all the fields.
  5. Check the connection to the server using the built-in web mail client or any other mail client.
  6. Configure MX domain records on VPS IP address for further acceptance of letters to mailboxes located on the server.

After configuring and adding mailboxes for them, it is recommended to configure SPF and DKIM records. You will need to generate an SPF record yourself, depending on the settings of the VestaCP panel itself. For the most part, an IP address is used and a similar entry may be suitable:

v=spf1 a mx ip4:XXX.XXX.XXX.XXX ~all

Instead XXX.XXX.XXX.XXX specify the IP address of the VPS server.

To obtain a public DKIM key, do the following:

  1. Connect to the server via SSH with root rights.
  2. After connecting to the server, run the command:
     export VESTA=/usr/local/vesta/
  3. After running the previous command, run the following to get the DKIM public key:
    /usr/local/vesta/bin/v-list-mail-domain-dkim-dns admin example.com
    • Instead "admin" – specify the username under which the mail domain was created in the VestaCP control panel.
    • Instead "example.com" – specify the mail domain to which you want to get the DKIM signature.
  4. Copy the entry line mail._domainkey from the result of the previous command, it will look something like this:
    RECORD            TTL         TYPE      VALUE
    ------            ---         ----      -----
    _domainkey        3600   IN   TXT      "t=y; o=~;"
    mail._domainkey   3600   IN   TXT      "k=rsa; p=MIGfMA0GCSqGSIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+FsN/9YOMojgLhwMzGDFOFZccPzxiXtRlZ0ek5CXLXgeQY+3HhQmCeJFz5RHykb84s/UGQFf/UyWUJS9o3BTpkWbgC9C4zqYvKTklMI511CEACfm+e07mOdfXjst31p9DP/TkQIDAQAB" 
  5. Add a new record for the domain, in which specify:
    • "Subdomain" — specify mail._domainkey... If an entry is added for a subdomain, then the subdomain name should be specified after the suggested option.
    • "Type" — select record type "TXT".
    • "Data" — copy the line from the output of the previously executed command VALUE for recording mail._domainkey... In the above example, it was the line
      k=rsa; p=MIGfMA0GCSqGSIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+FsN/9YOMojgLhwMzGDFOFZccPzxiXtRlZ0ek5CXLXgeQY+3HhQmCeJFz5RHykb84s/UGQFf/UyWUJS9o3BTpkWbgC9C4zqYvKTklMI511CEACfm+e07mOdfXjst31p9DP/TkQIDAQAB
Content