Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Reading mail is not as easy as sending it. To send mail perl only have to speak smtp which is a fairly simple protocol, so there are many tools for the purpose. Also as email is sent via store an forward, you only need to generate the message and send it on it's first hop, and the onward servers take care of the rest.

For receiving email it is more tricky because of the store and forward nature of the protocol. As atcroft said, if your mail is being delivered and stored to a POP3, or IMAP mailbox, then there are perl modules on cpan that will retrieve mail from those mailboxes.

It is also possible that your mail will be on some sort of webmail system like google mail. If that is the case then you will have to write or find code to scrape the website using modules such as HTML::TreeBuilder or WWW::Mechanize::Firefox, though in the case of Google, you can configure your account to be accessible via IMAP.

Finally it might be possible to receive mail directly over SMTP rather than polling a mailbox using something like Net::SMTP::Server or NetServer::SMTP. This would have the advantage of allowing your script to respond to incoming mails in realtime, but to do that you would need your own domain name where you can control the MX record in the DNS, your script would receive all mail to that domain you would need to manually forward any destined for other users yourself. Also you would need to be very cautions setting up such a server on an internet facing site due to the risk of remote hack attacks.


In reply to Re: read mail by chrestomanci
in thread read mail by cztmonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-18 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found