小编Dul*_*ude的帖子

Perl - 如何从标题的FROM部分获取电子邮件地址?

我正在尝试为我的本地乐队时事通讯设置此脚本.

目前,有人发送了一封要求添加的电子邮件,我们手动将其添加到我设置的新闻邮件中.(这要归功于我在这里找到的帮助!)

现在的目的是让我的脚本登录到我为服务器上的列表设置的电子邮件帐户,获取信息以自动添加电子邮件.

我知道有很多应用程序可以做到这一点,但我想学习自己.

我已经有"添加到列表"工作时,从BUT下方的标题(从)返回一个电子邮件地址,有时标题(来自)是一个名称而不是电子邮件地址(eg "persons name" is returned from persons name<email@address> but, not the <email@address>.)

现在,我对下面的方法并没有一丝不苟,但是,它有点着名......

我阅读了这些模块上的所有文档,但是我找不到任何东西可以随时获取电子邮件.

有人可以帮我吗?由于我在努力学习Perl,因此非常感谢详细的例子.

 #!/usr/bin/perl -w
    ##########
    use CGI;
    use Net::IMAP::Simple;
    use Email::Simple;
    use IO::Socket::SSL; #optional i think if no ssl is needed
    use strict;
    use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
    ######################################################
    # fill in your details here
    my $username = '#########';
    my $password = '#############';
    my $mailhost = '##############';
    #######################################################
    print CGI::header();
    # Connect
    my $imap = Net::IMAP::Simple->new($mailhost, port=> 143, use_ssl => 0, ) …
Run Code Online (Sandbox Code Playgroud)

email perl

2
推荐指数
1
解决办法
2959
查看次数

标签 统计

email ×1

perl ×1