Reputation:
I'm trying to send an email with custom headers but for some reason they just don't get through.
When I call my mailing method in the console, my custom parameter is actually listed:
<X-SMTPAPI: {"messageid" : "nomnom"}>
This is what I'm doing in my code:
headers["X-SMTPAPI"] = "{\"messageid\" : \"nomnom\"}"
mail(:to => @user.email, :subject => "Confirmation" )
Any idea what I'm doing wrong?
EDIT:
The problem seems to be with using X-SMTPAPI
as key. Using something else does work.
Upvotes: 1
Views: 941
Reputation: 584
The Headers can only be set to perfectly valid JSON. This should work:
headers['X-SMTPAPI'] = '{"thing": "SomeEmail"}'
Upvotes: 0
Reputation: 20639
The syntax for specifying headers is as follows:
headers({'X-No-Spam' => 'True', 'In-Reply-To' => '[email protected]'})
Looked at ActionMailer::Base documentation.
Upvotes: 2