mailjet / mailjet-gem

[API v3] Mailjet official Ruby GEM
https://dev.mailjet.com
Other
130 stars 72 forks source link

Email is not being sent if you dont provide the from_email #61

Closed mustela closed 8 years ago

mustela commented 8 years ago

Although I have a default from email configured as https://github.com/mailjet/mailjet-gem#api-key, and I'm using a template which also already define a subject and an email from, if I do

email = { 
          'Mj-TemplateID' => 15023,
          :recipients   => [{:email => "myemail@gmail.com"}] }

test = Mailjet::Send.create(email)

I receive

=> #<Mailjet::Send:0x007f9d645557e0
 @attributes=
  {"persisted"=>false,
   "Mj-TemplateID"=>15023,
   "recipients"=>[{"email"=>"myemail@gmail.com"}],
   "Sent"=>[{"Email"=>"myemail@gmail.com", "MessageID"=>18295908240864304}]},
 @persisted=true>

Which I assume nothing is missing, because there was no error, but the email is not being sent. I have to explicitly set :from_email => "help@mydomain.com".

Any clue why I have to set the from_email despite having it set in 2 different places?

Thanks

WeshGuillaume commented 8 years ago

Hey!

At the moment, the :from_email is used with with the ActionMailer only, I will try to add it with the send method

Guillaume.

WeshGuillaume commented 8 years ago

I created a pull request here : https://github.com/mailjet/mailjet-gem/pull/63

Please tell me if it was a template issue on your other issue so I can merge both of them at once if the issue is wrapper-related :)

Guillaume

mustela commented 8 years ago

You can merge that, since its not related to #62