Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:15:12+00:00 2026-06-12T19:15:12+00:00

I have a simple contact form on a site. There is an email account

  • 0

I have a simple contact form on a site.

There is an email account just to handle the mail being sent through the contact form. This is ‘mycompany.noreply@gmail.com’

The problem

When a user fills in the form and sends it, two emails are sent. One confirmation email to the user of the site and the actual filled in form to the company.

The company wants it so when they receive the email from the user, they hit reply and the users email address is automatically in the ‘to’ field. But when they do that at the moment, what they see is “Senders name ‘mycompany.noreply@gmail.com'” instead of “Senders name ‘sender_email_address'”.

The code

class Notifications < ActionMailer::Base

  def enquiry(user)
    @user = user
    mail(to: "employee@mycompany.com", subject: "website enquiry", from: "#{@user.name} <#{@user.email}>")
  end

  def no_reply(user)
    @user = user
    mail(to: @user.email, from: "My Company <mycompany.noreply@gmail.com>", subject: "Message received at mycompany.com")
  end
end

Tests

The test for the from field passes.

require "spec_helper"

describe Notifications do

  let(:contact_form) { FactoryGirl.build(:contact_form) }

  context "enquiry" do

    let(:mail) { Notifications.enquiry(contact_form) }

    it "renders the headers" do
      mail.from.should eq([contact_form.email])
    end
  end
end

Also, I am using mailcatcher.

Mailcatcher also shows the correct user.email in the from field.

It only seems to be when the actual email is received (using gmail) that the wrong address appears.

Any help appreciated.

EDIT

Default mail settings:

 # mail config settings
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = { 
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :user_name            => 'mycompany.noreply@gmail.com',
    :password             => 'password',
    :authentication       => 'plain',
    :enable_starttls_auto => true  }

mail header from mailcatcher

Date: Sat, 13 Oct 2012 21:08:02 +0100
From: Joe Bloggs <joebloggs@gmail.com>
To: mycomany.noreply@gamil.com
Message-ID: <5079ca229969b_67c23fc061434ed023056@Mark-Charless-iMac-2.local.mail>
Subject: website enquiry
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_5079ca226fb17_67c23fc061434ed02277b";
 charset=UTF-8
Content-Transfer-Encoding: 7bit



----==_mimepart_5079ca226fb17_67c23fc061434ed02277b
Date: Sat, 13 Oct 2012 21:08:02 +0100
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <5079ca227ec80_67c23fc061434ed02288a@Mark-Charless-iMac-2.local.mail>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:15:13+00:00Added an answer on June 12, 2026 at 7:15 pm

    The problem is that you’re using the Gmail SMTP server.

    As per this question: Rails and Gmail SMTP, how to use a custom from address, you cannot set custom From addresses unless that account is linked to your gmail account.

    Alternatives:

    1. Use another SMTP server that will allow you to set your own From addresses.
    2. Create a nice HTML-based email that is sent to employee@mycompany.com with a big button that is a mailto link to the email address of the user who filled in the form, and make sure they don’t reply to the automated emails, but use this button within the email.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Mail not being received by hotmail.com I have this simple form on
i have a simple contact us form and i need to send an email
i have made a simple php contact form following this tutorial: http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme The big
I have a simple contact form (name, email, subject, message) which sends messages to
I have a very simple contact form on my site, Im looking for users
I'm building a simple contact form for my site. In my model I have:
I have a very simple contact form with fields like this: <label> First Name<em>*</em>
I had this simple modal contact form working fine but must have broke it
I have a simple contact form with name, email, a select list, and textarea.
I have a simple contact form on my website that sends an email to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.