{"action":"created","issue":{"url":"https://api.github.com/repos/mailboxer/mailboxer/issues/320","labels_url":"https://api.github.com/repos/mailboxer/mailboxer/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/mailboxer/mailboxer/issues/320/comments","events_url":"https://api.github.com/repos/mailboxer/mailboxer/issues/320/events","html_url":"https://github.com/mailboxer/mailboxer/issues/320","id":50410185,"number":320,"title":"A simple way to change email 'from' by sender?","user":{"login":"speed-of-light","id":2149541,"avatar_url":"https://avatars.githubusercontent.com/u/2149541?v=3","gravatar_id":"","url":"https://api.github.com/users/speed-of-light","html_url":"https://github.com/speed-of-light","followers_url":"https://api.github.com/users/speed-of-light/followers","following_url":"https://api.github.com/users/speed-of-light/following{/other_user}","gists_url":"https://api.github.com/users/speed-of-light/gists{/gist_id}","starred_url":"https://api.github.com/users/speed-of-light/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speed-of-light/subscriptions","organizations_url":"https://api.github.com/users/speed-of-light/orgs","repos_url":"https://api.github.com/users/speed-of-light/repos","events_url":"https://api.github.com/users/speed-of-light/events{/privacy}","received_events_url":"https://api.github.com/users/speed-of-light/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-11-29T00:36:48Z","updated_at":"2015-02-26T09:15:48Z","closed_at":null,"body":"Hi there,\r\nIs it possible to change the email sender from default `no-reply@example.com` to sender.email?\r\n\r\nThank you. :astonished: "},"comment":{"url":"https://api.github.com/repos/mailboxer/mailboxer/issues/comments/76145246","html_url":"https://github.com/mailboxer/mailboxer/issues/320#issuecomment-76145246","issue_url":"https://api.github.com/repos/mailboxer/mailboxer/issues/320","id":76145246,"user":{"login":"lacco","id":17513,"avatar_url":"https://avatars.githubusercontent.com/u/17513?v=3","gravatar_id":"","url":"https://api.github.com/users/lacco","html_url":"https://github.com/lacco","followers_url":"https://api.github.com/users/lacco/followers","following_url":"https://api.github.com/users/lacco/following{/other_user}","gists_url":"https://api.github.com/users/lacco/gists{/gist_id}","starred_url":"https://api.github.com/users/lacco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lacco/subscriptions","organizations_url":"https://api.github.com/users/lacco/orgs","repos_url":"https://api.github.com/users/lacco/repos","events_url":"https://api.github.com/users/lacco/events{/privacy}","received_events_url":"https://api.github.com/users/lacco/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T09:15:48Z","updated_at":"2015-02-26T09:15:48Z","body":"Are you really sure about possible Spam implications when you allow your users to send E-Mails with custom from email addresses? Perhaps you want to set the reply to address instead?\r\n\r\nNevertheless, the following code is untested but it should show how this can be achieved. The basic idea is to provide a custom mailer class:\r\n\r\nconfig/initializers/mailboxer.rb:\r\n\r\n    Mailboxer.config do\r\n      config.message_mailer = ::MessageMailer\r\n    end\r\n\r\napp/mailer/message_mailer.rb\r\n\r\n    class MessageMailer < Mailboxer::MessageMailer\r\n      def send_email(message, receiver)\r\n        # not sure about this is still working in newer rails versions. Perhaps you have to override Mailboxer::MessageMailer#new_message_email and Mailboxer::MessageMailer#new_message_email and Mailboxer::reply_message_email\r\n        from(message.sender.email) \r\n        super\r\n      end\r\n    end"}}