Finding incoming mail server by email address

Discussion in 'Programming' started by f00, Feb 27, 2010.

  1. f00

    f00 New Member

    Joined:
    Feb 27, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    hello,

    I am a newbie :p I want a program to find the incoming mail server by entering an email address.

    for example:

    input: username@gmail.com
    result: pop.gmail.com

    please help! thanks
     
  2. thillai_selvan

    thillai_selvan New Member

    Joined:
    Feb 20, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    From the mail header itself we can see the incoming mail server
     
  3. thillai_selvan

    thillai_selvan New Member

    Joined:
    Feb 20, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Using the Perl's Mail::Module you can get and set the email header informations.
    For further informations please visit the perl's CPAN search about Mail::Header
     
  4. f00

    f00 New Member

    Joined:
    Feb 27, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    thanks, can give me an example?
     
  5. thillai_selvan

    thillai_selvan New Member

    Joined:
    Feb 20, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Here the sample code for extracting the header part from the mail.
    Code:
    use strict;
    use warnings;
    use Data::Dumper;
    
    use Mail::Header;
    my $messagefile = "mail"; #here the mail is a file which contains s data as this is for testing
    open(MESSAGE,"$messagefile") or
    die "Unable to open $messagefile:$!\n";
    my $header = new Mail::Header \*MESSAGE;
    print Dumper \$header;
    close(MESSAGE);
    
    The output will be as follows
    Code:
    $VAR1 = \bless( {
                       'mail_hdr_foldlen' => 79,
                       'mail_hdr_modify' => 0,
                       'mail_hdr_list' => [],
                       'mail_hdr_hash' => {},
                       'mail_hdr_mail_from' => 'KEEP',
                       'mail_hdr_lengths' => {}
                     }, 'Mail::Header' );
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice