Closed UgoMare closed 8 years ago
Hey @UgoMare !
Sorry about that. The API guides was a little bit ahead. I have pushed a fix on master
to make you code works:
variable = Mailjet::Send.create(
from_email: "pilot@mailjet.com",
from_name: "Mailjet Pilot",
subject: "Your email flight plan!",
text_part: "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
html_part: "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
recipients: [{'Email'=> 'passenger@mailjet.com'}],
attachments: [{'Content-Type' => 'text/plain', 'Filename' => 'test.txt', 'content' => 'VGhpcyBpcyB5b3VyIGF0dGFjaGVkIGZpbGUhISEK'}])
Attachment through the ActionMailer via the Mailjet Api is currently not supported, I am working on that.
Please let me know if the Send
snippet works on your side ! :)
Even after the update, it still doesn't works. I think the problem is not about the pluralisation of attachments in the commit: https://github.com/mailjet/mailjet-gem/commit/d1ef23b4059947fec0ecfbd3dd4bb9b0691023d3 but the class Mailjet::Send seems to be not accessible.
Mailjet.constants.select {|c| Class === Mailjet.const_get(c)}
Did you clone the repo ? It actually works on my side.
The update is not on ruby gem yet, you need to clone the last update on github and reference it in your gemfile
gem "mailjet", :path => '/path/to/mailjet-gem'
[:ApiError, :Connection, :MethodNotAllowed, :MessageDelivery, :Aggregategraphstatistics, :Apikey, :Apikeyaccess, :Apikeytotals, :Apitoken, :Axtesting, :Batchjob, :Bouncestatistics, :Campaign, :Campaignaggregate, :Campaigngraphstatistics, :Campaignoverview, :Campaignstatistics, :Clickstatistics, :Contact, :Contact_getcontactslists, :Contact_managecontactslists, :Contact_managemanycontacts, :Contactdata, :Contactfilter, :Contacthistorydata, :Contactmetadata, :Contactslist, :Contactslist_managecontact, :Contactslist_managemanycontacts, :Contactslistsignup, :Contactstatistics, :Csvimport, :DNS, :DNS_check, :Domainstatistics, :Eventcallbackurl, :Geostatistics, :Graphstatistics, :Listrecipient, :Listrecipientstatistics, :Liststatistics, :Manycontacts, :Message, :Messagehistory, :Messageinformation, :Messagesentstatistics, :Messagestate, :Messagestatistics, :Metadata, :Metasender, :Myprofile, :Newsletter, :Newsletter_detailcontent, :Newsletter_schedule, :Newsletter_send, :Newsletter_status, :Newsletter_test, :Newsletterblock, :Newsletterproperties, :Newslettertemplate, :Newslettertemplateblock, :Newslettertemplatecategory, :Newslettertemplateproperties, :Openinformation, :Openstatistics, :Parseroute, :Preferences, :Send, :Sender, :Senderstatistics, :Toplinkclicked, :Trigger, :User, :Useragentstatistics, :Widget, :Widgetcustomvalue]
Hey ! Did you manage to make it work on your side ?
Guillaume.
Yes thanks.
I'm trying to send email with attachment through the api.
The example in the gem say
But I don't know how to join an attachment.
And how can I add an attachment with mailjet api and ActionMailer.
The email is delivered without the attachment.