Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
We are using the smtp module to connect to sendgrid. We only want to use it when sending newsletters. Since we are paying for each mail using this third party smtp we dont want to use it for all mails. So we believe adding the smtp mail class is a better option than setting it for the whole site by default.
function smtp_enable() {
$systems = array(
'default-system' => 'DefaultMailSystem'
'smtp-system' => 'SmtpMailSystem'
)
variable_set('mail_system', array('default-system' => 'SmtpMailSystem'));
}
Comment | File | Size | Author |
---|---|---|---|
#10 | 1201198-dont_reset_mail_system_variable-10.patch | 792 bytes | ParisLiakos |
#2 | 1201198_dont-reset-mail_system-variable.patch | 792 bytes | ParisLiakos |
Comments
Comment #1
Fabianx CreditAttribution: Fabianx commentedCould you please provide a patch instead?
Comment #2
ParisLiakos CreditAttribution: ParisLiakos commentedNo,don't clear the mail_system variable and then set it:/
this is a more elegant way:
Then,domidc you could manipulate this variable as you wish without smtp or any other module interfering.
Also smtp wont screw other modules settings this way
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedAnd this is a bug.
Comment #4
longwaveThis bug breaks any other contrib module that provides their own MailSystem and that was installed before SMTP. This affects at least Ubercart: #1364612: Ubercart don't work with smtp module?
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedNewsletter too.
the workaround till now is enabling smtp before installing any other module:/
Comment #6
TR CreditAttribution: TR commentedFor a verbose explanation of why the SMTP module is doing the wrong thing, see http://drupal.org/node/900794#comment-4160574
Comment #7
pobster CreditAttribution: pobster commentedYeah thanks for this nice gotcha... How about you commit this fix and roll another release?
Pobster
Comment #8
ParisLiakos CreditAttribution: ParisLiakos commentedi guess we can rtbc it then^^
and then wait for maintainers to commit
Comment #9
wundo CreditAttribution: wundo commentedCould you please reroll it?
Comment #10
ParisLiakos CreditAttribution: ParisLiakos commentedsure...seems pretty much identical to me though?
doesnt #2 apply anymore?
Comment #11
wundo CreditAttribution: wundo commentedHmm never mind, it applied now.
I guess my HEAD was dirty, sorry about that.
Commited! :)