fatfreecrm / fat_free_crm

Ruby on Rails CRM platform
http://www.fatfreecrm.com
Other
3.58k stars 1.33k forks source link

host takes presedence over from in SMTP config, breaking relay #590

Closed ain closed 6 years ago

ain commented 7 years ago

Steps to reproduce:

  1. Configure host in config/settings.yml:

    :host: "subdomain.domain.com"
  2. Configure smtp in config/settings.yml:

    :smtp:
      :address: "smtp.sparkpostmail.com"
      :port: 587
      :from: "no-reply@domain.com"
      :enable_starttls_auto: true
      :authentication: :plain
      :user_name: "SMTP_Injection"
      :password: "<password>"
  3. Add Note under different user accounts to trigger email

What happens: email that is relayed is constructed with host setting, e.g.

From: "<user>" <no-reply@subdomain.domain.com>

causing DKIM check for verified senders to fail on SparkPost (or any other external service).

What should happen: Email should be relayed as by SMTP configuration, with

From: "<user>" <no-reply@domain.com>
ain commented 7 years ago

Having studied the code, I'd question the implementation at https://github.com/fatfreecrm/fat_free_crm/blob/2f6c6e3b344c990724fe8c72b3cd491c99c5d01e/app/mailers/subscription_mailer.rb#L16-L19

It uses host as default fallback without any regard to smtp settings which should have presedence. email_comment_replies, by the inline docu at least, also seems a completely separate area to rely on when dealing with SMTP relay.

CloCkWeRX commented 7 years ago

Oof, example.com :(