@@ -119,11 +119,11 @@ function get_site_info( $args, $site_enabled_check = true, $exit_if_not_found =
119119/**
120120 * Populate basic site info from db.
121121 *
122- * @param array $domains Array of all domains.
122+ * @param array $domains Array of all domains.
123123 *
124124 * @return string $preferred_challenge Type of challenge preffered.
125125 */
126- function get_preferred_ssl_challenge (array $ domains ) {
126+ function get_preferred_ssl_challenge ( array $ domains ) {
127127
128128 foreach ( $ domains as $ domain ) {
129129 if ( preg_match ( '/^\*/ ' , $ domain ) ) {
@@ -436,7 +436,8 @@ function site_status_check( $site_url ) {
436436 * Function to pull the latest images and bring up the site containers and set EasyEngine header.
437437 *
438438 * @param string $site_fs_path Root directory of the site.
439- * @param array $containers The minimum required conatainers to start the site. Default null, leads to starting of all containers.
439+ * @param array $containers The minimum required conatainers to start the site. Default null, leads to starting of
440+ * all containers.
440441 *
441442 * @throws \Exception when docker-compose up fails.
442443 */
@@ -520,7 +521,17 @@ function set_postfix_files( $site_url, $site_service_dir ) {
520521function configure_postfix ( $ site_url , $ site_fs_path ) {
521522
522523 chdir ( $ site_fs_path );
523- EE ::exec ( \EE_DOCKER ::docker_compose_with_custom () . ' exec postfix postconf -e \'relayhost = \'' );
524+
525+ $ default_from = EE ::launch ( \EE_DOCKER ::docker_compose_with_custom () . ' exec postfix sh -c \'echo $REPLY_EMAIL \'' )->stdout ;
526+
527+ if ( ! trim ( $ default_from ) ) {
528+ $ default_from = "no-reply@ $ site_url " ;
529+ }
530+
531+ EE ::exec ( \EE_DOCKER ::docker_compose_with_custom () . " exec php sh -c 'echo \"host postfix \ntls off \nfrom $ default_from \" > /etc/msmtprc' " );
532+ $ relay_host = EE ::launch ( \EE_DOCKER ::docker_compose_with_custom () . ' exec postfix sh -c \'echo $RELAY_HOST \'' )->stdout ;
533+ $ relay_host = trim ( $ relay_host , "\n\r" );
534+ EE ::exec ( \EE_DOCKER ::docker_compose_with_custom () . ' exec postfix postconf -e \'relayhost = ' . $ relay_host . '\'' );
524535 EE ::exec ( \EE_DOCKER ::docker_compose_with_custom () . ' exec postfix postconf -e \'smtpd_recipient_restrictions = permit_mynetworks \'' );
525536 $ launch = EE ::launch ( sprintf ( 'docker inspect -f \'{{ with (index .IPAM.Config 0) }}{{ .Subnet }}{{ end }} \' %s ' , $ site_url ) );
526537 $ subnet_cidr = trim ( $ launch ->stdout );
0 commit comments