fastlane/lib/fastlane/actions/mailgun.rb in fastlane-2.13.0 vs fastlane/lib/fastlane/actions/mailgun.rb in fastlane-2.14.0
- old
+ new
@@ -84,11 +84,16 @@
is_string: true),
FastlaneCore::ConfigItem.new(key: :reply_to,
env_name: "MAILGUN_REPLY_TO",
description: "Mail Reply to",
optional: true,
- is_string: true)
+ is_string: true),
+ FastlaneCore::ConfigItem.new(key: :attachment,
+ env_name: "MAILGUN_ATTACHMENT",
+ description: "Mail Attachment filenames, either an array or just one string",
+ optional: true,
+ is_string: false)
]
end
def self.author
@@ -112,10 +117,17 @@
html: mail_template(options)
}
unless options[:reply_to].nil?
params.store(:"h:Reply-To", options[:reply_to])
end
+
+ unless options[:attachment].nil?
+ attachment_filenames = [*options[:attachment]]
+ attachments = attachment_filenames.map { |filename| File.new(filename, 'rb') }
+ params.store(:attachment, attachments)
+ end
+
RestClient.post "https://api:#{options[:apikey]}@api.mailgun.net/v3/#{sandbox_domain}/messages", params
mail_template(options)
end
def self.mail_template(options)
@@ -156,10 +168,11 @@
reply_to: "EMAIL_REPLY_TO",
success: true,
message: "Mail Body",
app_link: "http://www.myapplink.com",
ci_build_link: "http://www.mycibuildlink.com",
- template_path: "HTML_TEMPLATE_PATH"
+ template_path: "HTML_TEMPLATE_PATH",
+ attachment: "dirname/filename.ext"
)'
]
end
def self.category