Koozali.org: home of the SME Server

Email Processing send to a script? Perl SME 5.6

mcd_sign

Email Processing send to a script? Perl SME 5.6
« on: June 25, 2004, 05:25:05 AM »
Hello. I am running version 5.6 and am looking for a way to process an email that gets sent to an account. This is what i would like to do:

- In server manager add a new account. For Example newmember@mydomain.com
- In this account change it to Forward to another address.
Rather than forward to an email address i would like to enter a script name eg. addnew. Which would send th email off to the script (pref. perl) which would be nice to have in an ftpable directory (eg. /home/e-smith/files/primary/files??) and process it an exit. If a reply was needed this could simply be done within the perl script.

I was fiddling around and thought that in the templates-user-custom/.qmail/e-smithForward20 I might be able to change it to something like this if the $EmailForward was set to 'forward':

    elsif ($EmailForward eq 'forward')
    {
##### CHANGES START HERE

   if($ForwardAddress !~ /\@/) ##CHECK FOR @
       {
      my $prog = "/home/e-smith/files/primary/files/$ForwardAddress.pl";
         my $ok = open(MF,$prog);
      open(MF,"$md/error.pl") if(!$ok);
      my $prog1 = join('',<MF>);
      close(MF);
      eval($prog1);
      exit;
      }

#####ELSE CONTINUE AS USUAL
   else
       {
       $OUT = "&" . $ForwardAddress . "\n";
       }
    }


As i do not know what programming language these templates are in and how they are used i do not know what to do from this point?

Any help would be greatly appreciated I also think it would be a useful little tool for proccessing email.

It would be used for example. If a user fills out a new membership form and it sends an email off to me. I look over the email and simply bounce it to the newmember@mydomain.com address and it processes the email, adds to the database and sends a reply to the new user confirming their addition.

Any ideas/help/direction would be excellent.
Best Regards,
mcd_sign

Offline satovey

  • ****
  • 75
  • +0/-0
    • Yevotas Ministry Network
Re: Email Processing send to a script? Perl SME 5.6
« Reply #1 on: June 27, 2004, 03:24:50 AM »
Quote from: "mcd_sign"
Hello. I am running version 5.6 and am looking for a way to process an email that gets sent to an account. This is what i would like to do:

- In server manager add a new account. For Example newmember@mydomain.com
- In this account change it to Forward to another address.
Rather than forward to an email address i would like to enter a script name eg. addnew. Which would send th email off to the script (pref. perl) which would be nice to have in an ftpable directory (eg. /home/e-smith/files/primary/files??) and process it an exit. If a reply was needed this could simply be done within the perl script.

It would be used for example. If a user fills out a new membership form and it sends an email off to me. I look over the email and simply bounce it to the newmember@mydomain.com address and it processes the email, adds to the database and sends a reply to the new user confirming their addition.

Any ideas/help/direction would be excellent.
Best Regards,
mcd_sign


An easier way to do this would be to create a new
group newgroup. Then add the username of the email address you want to forward to, to that group. For instance, if the email address is youremail@mydomain.com, add youremail to the group.
Now, you point the email address of the script to newgroup@mydomain.com, this will automatically forward the email to youremail@mydomain.com. Be sure not to add any other usernames to this goup as any username in this group will receive the email.

Hope this works for you,

Have fun.
Scott A Tovey

mcd_sign

Re: Email Processing send to a script? Perl SME 5.6
« Reply #2 on: June 30, 2004, 01:43:38 AM »
Thanks for your reply satovey,

I am not to sure if i explained it well enough.. It isn't really a matter of processing some form data when someone fills one in .... I am recieving the emails fine and they are all in a set format.

I would like to then bounce these emails from an email program to another email address which knows to get processed by a script?

This is purly so i can look over an email see if it isnt spam and is valid and then bounce it on to add to a database. I am sure there has to be an easy way.

Thanks Again
mcd_sign

Offline satovey

  • ****
  • 75
  • +0/-0
    • Yevotas Ministry Network
Re: Email Processing send to a script? Perl SME 5.6
« Reply #3 on: June 30, 2004, 05:46:13 PM »
Quote from: "mcd_sign"

I would like to then bounce these emails from an email program to another email address which knows to get processed by a script?

This is purly so i can look over an email see if it isnt spam and is valid and then bounce it on to add to a database. I am sure there has to be an easy way.


I remember a while back searching through a free script site comming across a cms that claimed to do something like that. The script, (I can't remember what is was called or where I found it) was set up so that all the webmaster had to do is send an email to a particular address and the email would be posted to the webpages on the website.

This may not be exactly what your looking form but is would be a start. If you have any perl knowlege, you could figure out how to adjust it to your liking.

Try this page first  http://www.thefreecountry.com/perlscripts/mailinglists.shtml may have what your looking for
these are mail list scripts. Read the one on Dada Mail

Scott
Scott A Tovey

mcd_sign

Re: Email Processing send to a script? Perl SME 5.6
« Reply #4 on: July 01, 2004, 02:17:26 AM »
Thanks again satovey,

Its odd i thought that kind of think would be pretty common place.....
I will take a look at the Dada mail although i was hoping it might just be a alteration in e-smith (a template change) and not another program entirly......thanks for your help.

maybe someone can tell me where the mail comes in and how i can get to it... that might be a good starting point... eg :  how the file:
home/e-smith/files/users/username/MailDir/new/181151.2119.Server

or better still the forward emails gets generated and how it gets handled

If anyone else out there has any ideas i would love to know...

Thanks Again
mcd_sign

Anonymous

Re: Email Processing send to a script? Perl SME 5.6
« Reply #5 on: July 01, 2004, 09:11:45 AM »
Quote from: "mcd_sign"
Thanks again satovey,

Its odd i thought that kind of think would be pretty common place.....
I will take a look at the Dada mail although i was hoping it might just be a alteration in e-smith (a template change) and not another program entirly......thanks for your help.

maybe someone can tell me where the mail comes in and how i can get to it... that might be a good starting point... eg :  how the file:
home/e-smith/files/users/username/MailDir/new/181151.2119.Server

or better still the forward emails gets generated and how it gets handled

If anyone else out there has any ideas i would love to know...

Thanks Again
mcd_sign


I just posted a how to for Soupermail. It lets people fill out a form and that info and/or  attachment is sent either to a email or database, your choice - I know you will be able to use it to receive the info in a specific pattern. You should I think then be able to forward it and let it finish its job of entering a database. Be sure to read both the soupermail info and the mimelite info. which install with no difficulty.

http://no.longer.valid/mylinks/singlelink.php?cid=90&lid=435

Ken

Offline satovey

  • ****
  • 75
  • +0/-0
    • Yevotas Ministry Network
Re: Email Processing send to a script? Perl SME 5.6
« Reply #6 on: July 01, 2004, 07:49:37 PM »
Quote from: "mcd_sign"
Thanks again satovey,

Its odd i thought that kind of think would be pretty common place.....
I will take a look at the Dada mail although i was hoping it might just be a alteration in e-smith (a template change) and not another program entirly......thanks for your help.

maybe someone can tell me where the mail comes in and how i can get to it... that might be a good starting point... eg :  how the file:
home/e-smith/files/users/username/MailDir/new/181151.2119.Server

or better still the forward emails gets generated and how it gets handled

If anyone else out there has any ideas i would love to know...

Thanks Again
mcd_sign


The mail server is qmail and is located in /var/qmail though there are templates. Documentation is located in /var/qmail/doc. This will give you some information on how to set up virtual users which will allow you to forward email to a particular address.

I don't think you can do what you want just by adjusting the templates. It all depends. Check the qmail documentation to see if there is a way to forward the email to a database. You can definitely forward to a username no problem, however, to cause the email to be posted to a specific database will require a different program as qmail does not use a database file in which to store email. It is a directory/multiple file format.

Scott
Scott A Tovey