Currently the module defaults to using $_SERVER['SERVER_NAME'] as hostname and HELO name.

Not all systems provides a valid hostname in $_SERVER['SERVER_NAME']. I.e. nginx could provide a wildcard name. The HELO name must be a fully qualified domain name and mail servers will reject mail when it is not.

This patch makes it configurable to set a custom hostname and/or HELO name. We will fallback to using $_SERVER['SERVER_NAME'] when not configured.

Comments

arnested created an issue. See original summary.

arnested’s picture

arnested’s picture

Status: Active » Needs review
damienmckenna’s picture

StatusFileSize
new2.2 KB

It needed some lines in hook_uninstall().

arnested’s picture

Thank you, @DamienMcKenna. Good catch!

estoyausente’s picture

Status: Needs review » Needs work
+++ b/smtp.admin.inc
@@ -171,6 +171,23 @@ function smtp_admin_settings() {
+  $form['client']['smtp_client_hostname'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Hostname'),
+    '#default_value' => variable_get('smtp_client_hostname', ''),
+    '#description'   => t('The hostname to use in the Message-Id and Received headers, and as the default HELO string. Leave blank for using %server_name.', array('%server_name' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain')),
+  );
+  $form['client']['smtp_client_helo'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('HELO'),
+    '#default_value' => variable_get('smtp_client_helo', ''),
+    '#description'   => t('The SMTP HELO/EHLO of the message. Defaults to hostname (see above).'),
+  );

Array are not according with drupal 8 codding standars.
https://www.drupal.org/coding-standards#array

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new2.17 KB

Updated per #6.

arnested’s picture

I know the arrays were not according to coding standards. But they were consistent with the style used in the rest of the module.

Either way it is not important to me (I'm generally strict on coding standards in my own code but don't want to enforce it on others modules).

estoyausente’s picture

@arnested ok. It's a good reason :=)

I didn't check others arrays in the module but I hate this style (it's a personal war) and while I was reviewing I saw it and... I had to told it. XD

Anyway now have both patches, mantainers can decide to use the first or the second one.

Thank for explain it :)

arnested’s picture

@estoyausente I think I hate it as much as you do :-)

damienmckenna’s picture

damienmckenna’s picture

This should be safe to include in the next release.

Anonymous’s picture

StatusFileSize
new31.56 KB

Applied great for me. Included a bunch of other patches as well. Terminal image included.

charlie-s’s picture

Thank you thank you. I use a custom tld (.dev) in my local development environment which is rejected by smtp.gmail.com, so this is a big help.

Tested and working for me in 7.x-1.3.

arnested’s picture

Cool. Please consider marking this as "Reviewed and tested by the community" so we can get the patch closer to being applied.

charlie-s’s picture

Status: Needs review » Reviewed & tested by the community

Per all discussion and review above, @arnested's note in #15, and @DamienMcKenna's note in #12, I'm going to change the status.

wundo’s picture

Priority: Normal » Major
Status: Reviewed & tested by the community » Needs work

This patch is not currently applying, could someone please re-roll it?

arnested’s picture

I'll do a reroll in 3-4 hours if no one beats me to it.

arnested’s picture

Status: Needs work » Needs review
StatusFileSize
new2.98 KB

Patch rerolled.

  • wundo committed 420fe1e on 7.x-1.x authored by arnested
    Issue #2656510 by arnested, DamienMcKenna, alex_drupal_dev, estoyausente...
wundo’s picture

Status: Needs review » Fixed

  • wundo committed 420fe1e on 7.x-2.x authored by arnested
    Issue #2656510 by arnested, DamienMcKenna, alex_drupal_dev, estoyausente...
  • wundo committed d112285 on 7.x-2.x
    Issue #2656510 by wundo: porting changes to 7.x-2.x
    
wundo’s picture

Status: Fixed » Patch (to be ported)

I did a quick merge from #19 to the new branch I created today with the changes we were working for #1705764: Support for multiple SMTP credentials/servers but I think the proper way to handle this would be to move the smtp_client_hostname and smtp_client_helo to be defined by SMTP provider.

Marking this as to be ported so we don't forget about working on this.

wundo’s picture

damienmckenna’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
osman’s picture

Version: 7.x-2.x-dev » 8.x-1.x-dev
Priority: Major » Normal
Status: Patch (to be ported) » Needs review
StatusFileSize
new3.22 KB

Here is an attempt to port this feature to 8.x branch.

naveenvalecha’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

wundo’s picture

  • wundo committed 9f1d6d8 on 8.x-1.x authored by osman
    Issue #2656510 by arnested, DamienMcKenna, osman, alex_drupal_dev, wundo...
wundo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.