jeudi 9 juin 2016

Ruby on Rails - Uploading and sending Attachments via Email

I have in my Webapplication a view to write Tickets, which sended via Mail to the Devlopers.

Now i want to add a function, to upload a files ( like an image ), which i picked via menu, and send this with my email.

My Mailer :

def support_ticket(current_user, support_ticket)
    users = User.where(:group_id => [Group.find_by_name('Developer').id])
    recipients = users.collect {|u| u.email if u.email[/@test./]}.compact.join(', ')
    recipients << (', ') + current_user.email.to_s
    from = current_user.email
    subject = I18n.translate('mailer.support_ticket.subject', :title => support_ticket.title)
    @user, @support_ticket = current_user, support_ticket
    setup_email(recipients, subject, from)
end  

Aucun commentaire:

Enregistrer un commentaire