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 6126027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:19:11+00:00 2026-05-23T16:19:11+00:00

I would like to alter the Message-ID header that is in the header portion

  • 0

I would like to alter the Message-ID header that is in the header portion of an email sent from a Ruby on Rails v3 application using ActionMailer.

I am using Sendmail on localhost for mail delivery.

Do I configure this in Sendmail or ActionMailer?

Where do I configure this (if it is ActionMailer): a file in config/ folder or a file in app/mailers/ folder?

  • 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-05-23T16:19:12+00:00Added an answer on May 23, 2026 at 4:19 pm

    I figured this out. The easiest way to do is to use the default method at the top of the mailer class file.

    Example:

    require 'digest/sha2'
    class UserMailer < ActionMailer::Base
      default "Message-ID"=>"#{Digest::SHA2.hexdigest(Time.now.to_i.to_s)}@yourdomain.com"
    
      # ... the rest of your mailer class
    end
    

    However, I found this difficult to test, so I wrote a private method and used the sent_at time instead of Time.now:

    def message_id_in_header(sent_at=Time.now)
      headers["Message-ID"] = "#{Digest::SHA2.hexdigest(sent_at.to_i.to_s)}@yourdomain.com"
    end
    

    And I simply called that method before calling the mail method. This made it easy to pass a sent_at parameter from my test and verify a match in email.encoded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to debug a .NET application that fails immediately on startup (and
I have an application that I would like to write an automated test for.
I have a WCF service with many methods. I would like that after executing
I have a NSThread that i would like to timeout after a certain amount
I would like to implement operations that is undoable in a short time after
I would like to create a plugin that uses the contact form 7 hook,
I have Problem with symfony i would like to execute the backend process from
I would like to connect to a FTP from Java. I have done this:
I would like to overwrite a default message for posting a comment. For example,
I would like to show an AJAX loading icon during an ActionResult request that

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.