ruby on rails - ActionMailer not returning full from address -



ruby on rails - ActionMailer not returning full from address -

i'm using actionmailer , in test i'm trying verify right address has been set. when utilize address sender name, email address when calling #from need check whole thing. i've tried checking #sender, nil

example:

msg1 = actionmailer::base::mail(:from => "sender name <test@example.com>").from => ["test@example.com"]

if to_s object, seem utilize total email including sender name:

msg1.to_s => "date: fri, 20 jun 2014 11:14:53 +0000\r\nfrom: sender name <test@example.com>\r\nmessage-id: <xxxx>\r\nsubject: mail\r\nmime-version: 1.0\r\ncontent-type: text/plain;\r\n charset=utf-8\r\ncontent-transfer-encoding: 7bit\r\n\r\n"

how verify address (including sender name) has been set correctly?

i may not correctly understand question, if guess correctly can infos this:

msg1 = actionmailer::base::mail(:from => "sender name <test@example.com>") msg1.from => ["test@example.com"] msg1.date => fri, 20 jun 2014 18:58:38 +0530 msg1.message_id => "53a43706753f4_49053fb4eba3f9b43008a@shivam.mail" msg1.message_content_type => "text/plain" msg1.main_type => "text" msg1.subject => "mail"

also can type msg1. , nail <tab> twice. terminal inquire display 293 possibilities? (y or n) press y , can see info can extract particular option.

edit

i guess understand question improve , did research. way entering sender name, seems cannot retrieve directly. however, may utilize regex in case. here code, know (extremely) dirty, works nonetheless:

pat = "(?<=from:)(.*)(?=<#{msg1.from.to_s})" /#{pat}/.match(msg1.inspect)[0].strip

ruby-on-rails email

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -