Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

forwarding a mail to the perl program

eaglorteaglort Member Posts: 7
hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
[hr][b][e]agLrT[/b]
«1

Comments

  • heeroyuyheeroyuy Member Posts: 125
    : hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
    : [hr][b][e]agLrT[/b]
    :

    Could u clarify what u mean by forwarded by the perl file, do u mean like jus send the address to the perl file, or actually configure the dns to send the mail to the script.
    -----------------------
    [RED]Heero Yuy
    Perl Board Moderator
    Perl Semi-Expert[/RED]

  • bgibbybgibby Member Posts: 251
    : hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
    : [hr][b][e]agLrT[/b]
    :

    Hi there,

    Do you mean that you have an email and it's sent to post@anything.com and your Perl script has access to this mailbox. Once an email is sent, the Perl script reads the email and executes the instructions within the email?

    Cya
    Bradley q:)
  • eaglorteaglort Member Posts: 7
    : : hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
    : : [hr][b][e]agLrT[/b]
    : :
    :
    : Hi there,
    :
    : Do you mean that you have an email and it's sent to post@anything.com and your Perl script has access to this mailbox. Once an email is sent, the Perl script reads the email and executes the instructions within the email?
    :
    : Cya
    : Bradley q:)
    :

    not exactly access, i want to send the messages directly to the program... and the program will read the message and do what it has to. see?
  • eaglorteaglort Member Posts: 7
    : : hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
    : : [hr][b][e]agLrT[/b]
    : :
    :
    : Could u clarify what u mean by forwarded by the perl file, do u mean like jus send the address to the perl file, or actually configure the dns to send the mail to the script.
    : -----------------------
    : [RED]Heero Yuy
    : Perl Board Moderator
    : Perl Semi-Expert[/RED]
    :
    :

    i want to configure some of my mail addresses to go directly to the program. i mean, when you get new mail message it goes to its mailbox, but i do not want the messages stay in the mailbox, just go to the program... and let the program decide what to do... see?
  • heeroyuyheeroyuy Member Posts: 125
    So you mean like a socket connection were one computer runs a perl program that establishes a connection with an already existing perl program over a socket, and then sends information to tell the perl program what to do, or are you hinting at a CGI thing that takes messages through an arguments(URL or other)


    -----------------------
    [RED]Heero Yuy
    Perl Board Moderator
    Perl Semi-Expert[/RED]

  • eaglorteaglort Member Posts: 7
    : So you mean like a socket connection were one computer runs a perl program that establishes a connection with an already existing perl program over a socket, and then sends information to tell the perl program what to do, or are you hinting at a CGI thing that takes messages through an arguments(URL or other)
    :
    :
    : -----------------------
    : [RED]Heero Yuy
    : Perl Board Moderator
    : Perl Semi-Expert[/RED]
    :
    :

    no! just forget all you saw in my messages, lets take it again. for example; i have an email address (post@eaglort.com), someone sent a mail to that address to post a message (hi there...), and my program got the message (hi there...) from the body and saved it to a file. this is the event i want to do! i want to forward an email address (the message inside) to a perl program. see? :)
  • heeroyuyheeroyuy Member Posts: 125
    Uh........I don't think you can do that :0 I think it MIGHT(very very unlikely) be done by setting a domain name to forward to a perl script, but even then, you'd need special configurations, etc, on the perl script to do it. If anyone else has any other ideas, i would be glad to hear them! As far as I can see, and I know I don't know everything, it isn't very possible. The closest you might get would be to access the mailbox in which the data is stored, then handle the data.
    -----------------------
    [RED]Heero Yuy
    Perl Board Moderator
    Perl Semi-Expert[/RED]

  • sealnesealne Member Posts: 2
    : hi. i want to forward one email alias to my perl program. lets say i have an email address like post@anything.com and a perl file called post.pl now i want to configure the alias post@anything.com to be forwarded to my perl file and make the program grab the message and do anything i wrote in it. i think i could explain! please, someone help me! thankss...
    : [hr][b][e]agLrT[/b]
    :

    Hi

    I've been working on a similar thing, I think you are wanting to use the Mail::Internet module.

    I call my script via the aliases file but the same could be done from a .forward or procmail

    The following code will handle getting an email piped to it:

    ###### begin code snippet #######
    #!/usr/bin/perl -w
    use Mail::Internet;
    use Date::Parse;

    #read the mail in from STDIN
    $message = new Mail::Internet *STDIN;
    #optionally remove blank lines at begining and end of email
    $message->tidy_body();

    #get the to field
    $to = $message->get("To");
    #get the from field
    $from = $message->get("From");
    #get the date field and convert it to another format suitable for mysql
    $datestring = $message->get("Date");
    ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($datestring);
    $date = "$year-$month-$day-$hh-$mm-$ss";
    #get the subject field
    $subject = $message->get("Subject");
    #get the whole header text as a string
    $header = $message->head->as_string;
    #get the body and join it back together as one string
    *body_array = $message->body();
    $body = join '', @body_array;

    ####### end code snippet #######

    the code above dosen't do anything with the email but I then stick it into a database or you could do what ever you want with it.

    HTH

    seaLne
  • eaglorteaglort Member Posts: 7
    : Uh........I don't think you can do that :0 I think it MIGHT(very very unlikely) be done by setting a domain name to forward to a perl script, but even then, you'd need special configurations, etc, on the perl script to do it. If anyone else has any other ideas, i would be glad to hear them! As far as I can see, and I know I don't know everything, it isn't very possible. The closest you might get would be to access the mailbox in which the data is stored, then handle the data.
    : -----------------------
    : [RED]Heero Yuy
    : Perl Board Moderator
    : Perl Semi-Expert[/RED]
    :
    :

    thanks anyway. i am just asking what you told, the configuration.. take a look at sealne's message...
  • eaglorteaglort Member Posts: 7
    thanks man, this is just what i want! :) and i will be really happy if you know how to set the forward? i think i will use a linux server, and i dont know how to configure the alias.

    [hr][b][e]agLrT[/b]

«1
Sign In or Register to comment.