title: Seding emails with Devise gem and Mailgun Api
body: <p>I want to send automated emails via Mailgun either SMTP or API. The problem is that in tutorials I find they explain how to do that manually e.i creating mailer class etc. For example like that:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>def send_simple_message
    RestClient.post "https://api:YOUR_API_KEY"\
    "@api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages",
    :from =&gt; "Excited User &lt;mailgun@YOUR_DOMAIN_NAME&gt;",
    :to =&gt; "bar@example.com, YOU@YOUR_DOMAIN_NAME",
    :subject =&gt; "Hello",
    :text =&gt; "Testing some Mailgun awesomness!"
  end</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is from official Mailgun documentation.</p>
  
  <p>But I am using Devise gem which has email sending implemented. </p>
  
  <p>For example I want to send password reset email. When I click forgot password and submit my email from logs I see that my email is tried to be sent, but not sent of course, I need to set up email server.</p>
  
  <p>So the question is where is this code for sending recovery email is written in devise, how to override it? I want it to oveeride so it will use Mailgun API for example.</p>
  
  <p>I have already generated registrations_controller.rb using </p>
  
  <blockquote>
    <p>rails generate devise:controllers registrations </p>
  </blockquote>
  
  <p>command. So I suppose I am overriding it here?
  Any suggestions?</p>