Views: 11910
Last Modified: 19.01.2024

Bitrix24 On-premise editions Main module version 21.900.0 has a new SMTP option allowing to organize dedicated email streams.

   General information

How emails are sent fr om site/instance

For Bitrix24 On-premise, user calls a global function bxmail, triggering standard PHP mail function, wrapping an email with headers. After that, mail function queries your internal infrastructure (depending on your configuration Bitrix Framework requires setup for sending and receiving emails. There are three options for sending emails:

- via local sendmail or postfix (when site uses Linux);

- via third-party SMTP server without authentication (for Windows);

- via third-party server with authentication by replacing email sender function.
: postfix, sendmail or any custom solution, operating based on queues, sending all emails via mail function).

All emails (email campaigns and single emails, CRM emails, password restoration emails, workflows, etc.) are included into a single stream.

Using new local SMTP server settings you can configure dedicated streams as per custom requirements.

Advantages of sender's SMTP server

  • dedicated streams;
  • use of aliases Aliases are additional mailbox names. They are used to assign additional names to a single mailbox located at your domain. For example, you have a mailbox mysite@example.com. You can add an alias marketing<mysite@example.com> for marketing department. After this action, users receiving an email from marketing department will see only marketing as a sender.

    When users respond to this email, their reply is sent to an actual mailbox mysite@example.com.
    (alias);
  • simple setup;
  • debugging option;
  • option to send on hits;
  • option to maintain open connection (useful for bulk mail).

  Enabling SMTP server

To enable sender's SMTP server in Bitrix24 On-premise editions, you need to edit the file /bitrix/.settings.php Bitrix Framework has a variety of kernel/core settings that do not have visual UI for editing. This is due to updated settings or an error can easily cause the complete system to malfunction (database connection settings, cache settings and etc.).

Learn more...
, by adding the corresponding code:

return [
	//…
	'smtp' => [
		'value' => [
			'enabled' => true,
			'debug' => true, //optional
			'log_file' => '/var/mailer.log' //optional
		]	 
	]
];

Important! Extra caution is advised when editing the .settings.php file: a single error can easily cause the complete system to malfunction.

Settings parameters:

  • enabled – enabling the SMTP server for the sender;
  • debug – optional parameter (disabled by default). Enable it if you want to see the complete interaction process with SMTP servers;
  • log_file – optional parameter. Can indicate a file for collection of logs, by entering full path to file (this file requires access). By default, project/site directory already contains the file mailer.log with all logs incoming logs.

  SMTP connection setup

SMTP connection can be configured by two methods:

  • When creating new email message, add a sender , click on the link SMTP server and complete the displayed config fields for connecting an SMTP server:

    • enter name and email;
    • indicate SMTP server sender's visibility: for you only or visible for all users;

      Note: Each employee can connect a dedicated SMTP server.

    • indicate email server;
    • enter a port (mostly three values are used: 25, 465, 587);
    • indicate maximum daily message limits Various email services (Google, Yahoo, etc.) have different limits on the number of sent emails (most frequently its the lim it on the number of emails sent per 24 hours). With this option enabled, Bitrix24 will maintain statistics on the number of dispatched emails and issue errors, when limits are reached. ;
    • enter login and password for connected SMTP server.
  • Similar form for connecting SMTP server can be completed at the site's Control panel at Settings > System settings > Email and SMS events > SMTP settings, by clicking on the button Add SMTP connection:

    Note: Currently, daily message limits config is not available for SMTP connections added inside the Control panel.

Are the settings described above connected with SMTP settings at the Bitrix24 Virtual Appliance?

SMTP server settings described in this lesson are not associated with BitrixVM SMTP settings Complete the following actions to configure SMTP client:

1. Go to the main menu 6. Configure pool sites > 4. Change e-mail settings on site and enter email host name

Learn more...
.

Example: BitrixVM site has a configured Gmail via BitrixVM menu This lesson contains some examples of email services employed at BitrixVM.

Learn more...
. Add new SMTP connection for Yahoo.com via site administrative section. Now, the From field in a new email or email campaign has a selection of two email services: Gmail and Yahoo. Depending on which service is selected, system sends emails either using Bitrix Virtual Appliance or Bitrix24 core.

Can there be conflicting email duplication in case SMTP has been configured both locally and on the virtual appliance?

No, settings won't clash or emails won't duplicate. When sending an email the system checks, if there is an active smtp parameter in the file /bitrix/.settings.php:

  • if such such parameter exists, email will be sent via local SMTP;
  • if such parameter doesn't exist, an email will be sent using server functionality via msmtp For SMTP client setup, execute the following:

    1. At the main menu, go to 6. Configure pool sites > 4. Change e-mail settings on site and enter the host name to configure email dispatch

    Learn more...
    .




Courses developed by Bitrix24