Giter Site home page Giter Site logo

from address with display name about mail HOT 5 CLOSED

mikel avatar mikel commented on June 3, 2024
from address with display name

from mail.

Comments (5)

mikel avatar mikel commented on June 3, 2024

calling m[:from] will return the underlying object.

m = Mail.new("Mikel Lindsaar <[email protected]>")
from = m[:from]
from.formatted 
#=> ["Mikel Lindsaar <[email protected]>"]

HTH

Mikel

from mail.

kbaum avatar kbaum commented on June 3, 2024

That works. Is there any convenient way to just get the display name though? It seems like the Mail::Address class has what I need but I'm not sure the proper way to use it.

Thanks for your help.

thx.

from mail.

mikel avatar mikel commented on June 3, 2024

There was, but it got lost somewhere along the way :)

I just added that back in on trunk Mail. But be warned on trunk mail, it is 2.0 and has a lot of changes in Network delivery etc.

You can update to latest trunk Mail, and it will give you:

from.addrs          #=> [<#Mail::Address..>, <#Mail::Address...>]
from.display_names  #=> ['Mikel Lindsaar', 'Bob Smith']

Or if you dont want to upgrade, you could possibly do:

from.send(:tree).addresses.first.display_name

But that is an unsupported HACK :)

Mikel

from mail.

kbaum avatar kbaum commented on June 3, 2024

Cool. I am only using mail to parse emails that are already downloaded so i think i should be ok.

Unrelated question. Is mail intended to support imap eventually?

Thanks for your help!

-karl

from mail.

mikel avatar mikel commented on June 3, 2024

Re IMAP, sure.. just needs to be written and a good DSL worked out :)

Mikel

from mail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.