I want the SMTP message_id of a mail using deliver_later(sidekiq).
I am able to get the id in the return obj of deliver_now but not deliver_later.
Message_id is also missing in the return value of mail() function inside my_action_mailer
- when I send mail using-
sent_mail = some_mail().deliver_later
the response is a sidekiq job object which looks like this-
#<ActionMailer::DeliveryJob:0x007fefa1454780 @arguments=["xxxxxxx", "xxxxxxx", "deliver_now", xxxxxxx], @job_id="69b13253-55f9-4db9-a10a-0e8e4b998584", @queue_name="mailers", @priority=nil, @executions=0, @provider_job_id="6f75131d0c485534322cd728">
- when I send the mail using -
sent_mail = some_mail().deliver_now
the response is a object object which looks like this-
<Mail::Message:xx, Multipart: true, Headers: <Date: xx>, <From: "xx" <xx@xx.com>>, <Reply-To: "xx" <xx@xx.com>>, <To: ["xx@xx.com"]>, <Message-ID: <5a7863381167a_ba183fdfebc3f928907cb@xx-xx-xx.xx.mail>>, <Subject: xx>, <Mime-Version: 1.0>, <Content-Type: multipart/mixed; boundary="--==_mimepart_xx"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
If you'll look closely at the above output, the return class is Mail::Message and it contains "Message-ID", which is what I need.
- Also, when we call mail() function inside my mailer class, it also returns Mail::Message object but this obj dosent not contains Message-ID returned from SMTP server.
Is there any way in which I can get a Message-ID with using deliver_later