Need help to change the Postfix code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help to change the Postfix code

Arora, Sumit

Hi All,

 

I’m new to postfix, I need to execute my code when I receive a new email on my postfix smtp server.

Please give me some idea, where I can get the postfix code documentation so that I can change its code.

 

All and any type of suggestions are most welcome, I’ll really appreciate.

 

Thanks in advance,

Sumit Arora

Reply | Threaded
Open this post in threaded view
|

Re: Need help to change the Postfix code

Ramprasad-5

On Mon, 2009-09-14 at 09:27 +0000, Arora, Sumit wrote:

> Hi All,
>
>  
>
> I’m new to postfix, I need to execute my code when I receive a new
> email on my postfix smtp server.
>
> Please give me some idea, where I can get the postfix code
> documentation so that I can change its code.
>
>  
>
> All and any type of suggestions are most welcome, I’ll really
> appreciate.
>
To change postfix code for such a thing is absolutely unnecessary

You can run a custom script in postfix by piping the mail to a script
via aliases , or a master.cf entry










Reply | Threaded
Open this post in threaded view
|

Re: Need help to change the Postfix code

Egoitz Aurrekoetxea Aurre-2
In reply to this post by Arora, Sumit
> Hi All,
>
> I'm new to postfix, I need to execute my code when I receive a new email
> on my postfix smtp server.
> Please give me some idea, where I can get the postfix code documentation
> so that I can change its code.

Depending on what the code does... you could run a script passing content
to it via pipe in master.cf. This way is like maildrop mda works for
example.

What exactly does you're code?.

>
> All and any type of suggestions are most welcome, I'll really appreciate.
>
> Thanks in advance,
> Sumit Arora
>


Reply | Threaded
Open this post in threaded view
|

RE: Need help to change the Postfix code

Arora, Sumit
Thanks egoitz & Ram.

Actually I don't need the whole functionality of Postfix, I also need to cut the code for my requirement only.
My requirement is to just receive the email and send the body and attachments to another component.
There is no requirement of sending any email from my postfix server.

Now my question is, is it worth to cut the code and use the only module which I need or I should go with the whole postfix?

Many Thanks,
Sumit Arora


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Monday, September 14, 2009 6:30 PM
To: [hidden email]
Subject: Re: Need help to change the Postfix code

> Hi All,
>
> I'm new to postfix, I need to execute my code when I receive a new email
> on my postfix smtp server.
> Please give me some idea, where I can get the postfix code documentation
> so that I can change its code.

Depending on what the code does... you could run a script passing content
to it via pipe in master.cf. This way is like maildrop mda works for
example.

What exactly does you're code?.

>
> All and any type of suggestions are most welcome, I'll really appreciate.
>
> Thanks in advance,
> Sumit Arora
>

Ram wrote:

To change postfix code for such a thing is absolutely unnecessary

You can run a custom script in postfix by piping the mail to a script via aliases , or a master.cf entry

Reply | Threaded
Open this post in threaded view
|

Re: Need help to change the Postfix code

Wietse Venema
Arora, Sumit:

> Thanks egoitz & Ram.
>
> Actually I don't need the whole functionality of Postfix, I also
> need to cut the code for my requirement only.  My requirement is
> to just receive the email and send the body and attachments to
> another component.
> There is no requirement of sending any email from my postfix server.
>
> Now my question is, is it worth to cut the code and use the only
> module which I need or I should go with the whole postfix?

I suggest that you use the documented pipe-to-command interface.
You can pipe-to-command with ~/.forward (see "man 5 aliases")
and with the pipe(8) delivery agent (see "man 8 pipe").

Postfix only runs the programs that you need.  If you never send
(or receive) mail via SMTP, then the SMTP client (or server) program
will never run.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Need help to change the Postfix code

Stan Hoeppner
In reply to this post by Arora, Sumit
Arora, Sumit put forth on 9/14/2009 7:51 AM:
> Thanks egoitz & Ram.
>
> Actually I don't need the whole functionality of Postfix, I also need to cut the code for my requirement only.
> My requirement is to just receive the email and send the body and attachments to another component.
> There is no requirement of sending any email from my postfix server.
>
> Now my question is, is it worth to cut the code and use the only module which I need or I should go with the whole postfix?

It's really starting to sound like qpsmtpd might be a better fit for your project.  
http://smtpd.develooper.com/

You need to receive email via smtp and just pipe it to your project program, and you need to strip your smtpd down to the bare minimum of code, correct?  qpsmtpd may be ideal for this.  It is written entirely in perl and thus you automatically have the full source code and can modify and strip it as you see fit, without the need for recompiling after changes.  qpsmtpd by default is strictly an smtp daemon, not a full MTA.

I know of a corporation running a very large spam trap operation, with qpsmtpd running on a dozen or so old Sparc machines, hosting thousands of spam trap addresses across hundreds of domains.  The spam email comes in, a copy is written to a database, some custom perl code is run, and that's about it.  These machines are basically 'shovels' used to sling the spam samples into the database 'pit' as fast as possible because the load is extremely high.  qpsmtpd is relatively lightweight and fast, and can run very high levels of concurrency for good throughput.  This operation is handling multiple millions of trap messages/day with qpsmtpd.

If you're attempting to do something similar, I might be able to put you in contact with this trap operator.

--
Stan
Reply | Threaded
Open this post in threaded view
|

Need help to forward emails

Arora, Sumit
In reply to this post by Wietse Venema
Hi All,

I need to execute my code when I receive email on my postfix smtp server.

Sorry I couldn't understand what Wietse said:
You can pipe-to-command with ~/.forward (see "man 5 aliases") and with the pipe(8) delivery agent (see "man 8 pipe").

Can anybody tell me what I can do if I want to execute my java function when I receive email.
Also I need my whole email content in my java function.

It will be great if anyone can show me some examples.

Many Thanks,
Sumit Arora
Reply | Threaded
Open this post in threaded view
|

Re: Need help to forward emails

Daniel V. Reinhardt



Hi All,

I need to execute my code when I receive email on my postfix smtp server.

Sorry I couldn't understand what Wietse said:
You can pipe-to-command with ~/.forward (see "man 5 aliases") and with the pipe(8) delivery agent (see "man 8 pipe").

Can anybody tell me what I can do if I want to execute my java function when I receive email.
Also I need my whole email content in my java function.

It will be great if anyone can show me some examples.

Many Thanks,
Sumit Arora



----------------------

My Reply


You can add another email address to the aliases file if you are running just straight postfix with no modifications like so:

root: [hidden email]

that would forward roots email to [hidden email]

Thanks,
Daniel

Reply | Threaded
Open this post in threaded view
|

RE: Need help to forward emails to my java function

Arora, Sumit

Sorry my subject was not descriptive…

 

From: Daniel V. Reinhardt [mailto:[hidden email]]
Sent: Tuesday, September 15, 2009 7:02 PM
To: Arora, Sumit; Postfix users
Subject: Re: Need help to forward emails

 

 



Hi All,

I need to execute my code when I receive email on my postfix smtp server.

Sorry I couldn't understand what Wietse said:
You can pipe-to-command with ~/.forward (see "man 5 aliases") and with the pipe(8) delivery agent (see "man 8 pipe").

Can anybody tell me what I can do if I want to execute my java function when I receive email.
Also I need my whole email content in my java function.

It will be great if anyone can show me some examples.

Many Thanks,
Sumit Arora



----------------------

My Reply


You can add another email address to the aliases file if you are running just straight postfix with no modifications like so:

root: [hidden email]

that would forward roots email to [hidden email]

Thanks,
Daniel

 

Reply | Threaded
Open this post in threaded view
|

how to pipe the received emails to my java function

Arora, Sumit

Hi All,

I need to execute my code when I receive email on my postfix smtp server.

Can anybody tell me what I can do if I want to execute my java function when I receive email.
Also I need my whole email content in my java function.

It will be great if anyone can show me some examples.

Many Thanks,
Sumit Arora


 

Reply | Threaded
Open this post in threaded view
|

Re: how to pipe the received emails to my java function

Erwan David
On Wed, Sep 16, 2009 at 09:10:01AM CEST, "Arora, Sumit" <[hidden email]> said:
> Hi All,
>
> I need to execute my code when I receive email on my postfix smtp server.
>
> Can anybody tell me what I can do if I want to execute my java function when I receive email.
> Also I need my whole email content in my java function.
>
> It will be great if anyone can show me some examples.

Look at the pipe transport, its purpose is exactly to pipe mail to an
external program.

--
Erwan
Reply | Threaded
Open this post in threaded view
|

RE: how to pipe the received emails to my java function

Arora, Sumit
Thanks Erwan

As I'm new to postfix I couldn't understand what u said, I googled it but didn't get any result useful to me.

Can u plz explain with some examples..

Many Thanks,
Sumit Arora

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Erwan David
Sent: Wednesday, September 16, 2009 12:44 PM
To: [hidden email]
Subject: Re: how to pipe the received emails to my java function

On Wed, Sep 16, 2009 at 09:10:01AM CEST, "Arora, Sumit" <[hidden email]> said:
> Hi All,
>
> I need to execute my code when I receive email on my postfix smtp server.
>
> Can anybody tell me what I can do if I want to execute my java function when I receive email.
> Also I need my whole email content in my java function.
>
> It will be great if anyone can show me some examples.

Look at the pipe transport, its purpose is exactly to pipe mail to an
external program.

--
Erwan
Reply | Threaded
Open this post in threaded view
|

Re: how to pipe the received emails to my java function

Patrick Ben Koetter
* Arora, Sumit <[hidden email]>:
> Thanks Erwan
>
> As I'm new to postfix I couldn't understand what u said, I googled it but
> didn't get any result useful to me.

Have you read "man 8 pipe" yet?

> Can u plz explain with some examples..

You can find some examples in /etc/postfix/master.cf. Look for commands that
specify "pipe" in the command column.

p@rick



>
> Many Thanks,
> Sumit Arora
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Erwan David
> Sent: Wednesday, September 16, 2009 12:44 PM
> To: [hidden email]
> Subject: Re: how to pipe the received emails to my java function
>
> On Wed, Sep 16, 2009 at 09:10:01AM CEST, "Arora, Sumit" <[hidden email]> said:
> > Hi All,
> >
> > I need to execute my code when I receive email on my postfix smtp server.
> >
> > Can anybody tell me what I can do if I want to execute my java function when I receive email.
> > Also I need my whole email content in my java function.
> >
> > It will be great if anyone can show me some examples.
>
> Look at the pipe transport, its purpose is exactly to pipe mail to an
> external program.
>
> --
> Erwan

--
All technical questions asked privately will be automatically answered on the
list and archived for public access unless privacy is explicitely required and
justified.

saslfinger (debugging SMTP AUTH):
<http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>
Reply | Threaded
Open this post in threaded view
|

RE: how to pipe the received emails to my java function

Arora, Sumit
Thanks p@rick..

I read "man 8 pipe"..

And what I understand is, I need to change the configuration somewhere here in master.cf:

# ====================================================================
#
# Other external delivery methods.
#
#ifmail    unix  -       n       n       -       -       pipe
#  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#
#bsmtp     unix  -       n       n       -       -       pipe
#  flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
#scalemail-backend unix -       n       n       -       2       pipe
#  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
#  ${nexthop} ${user} ${extension}
#
#mailman   unix  -       n       n       -       -       pipe
#  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
#  ${nexthop} ${user}


Can I use .sh script here?

Thanks,
Sumit Arora


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Patrick Ben Koetter
Sent: Wednesday, September 16, 2009 1:53 PM
To: [hidden email]
Subject: Re: how to pipe the received emails to my java function

* Arora, Sumit <[hidden email]>:
> Thanks Erwan
>
> As I'm new to postfix I couldn't understand what u said, I googled it but
> didn't get any result useful to me.

Have you read "man 8 pipe" yet?

> Can u plz explain with some examples..

You can find some examples in /etc/postfix/master.cf. Look for commands that
specify "pipe" in the command column.

p@rick



>
> Many Thanks,
> Sumit Arora
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Erwan David
> Sent: Wednesday, September 16, 2009 12:44 PM
> To: [hidden email]
> Subject: Re: how to pipe the received emails to my java function
>
> On Wed, Sep 16, 2009 at 09:10:01AM CEST, "Arora, Sumit" <[hidden email]> said:
> > Hi All,
> >
> > I need to execute my code when I receive email on my postfix smtp server.
> >
> > Can anybody tell me what I can do if I want to execute my java function when I receive email.
> > Also I need my whole email content in my java function.
> >
> > It will be great if anyone can show me some examples.
>
> Look at the pipe transport, its purpose is exactly to pipe mail to an
> external program.
>
> --
> Erwan

--
All technical questions asked privately will be automatically answered on the
list and archived for public access unless privacy is explicitely required and
justified.

saslfinger (debugging SMTP AUTH):
<http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>
Reply | Threaded
Open this post in threaded view
|

Re: how to pipe the received emails to my java function

Wietse Venema
Arora, Sumit:

> Thanks p@rick..
>
> I read "man 8 pipe"..
>
> And what I understand is, I need to change the configuration somewhere here in master.cf:
>
> # ====================================================================
> #
> # Other external delivery methods.
> #
> #ifmail    unix  -       n       n       -       -       pipe
> #  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
> #
> #bsmtp     unix  -       n       n       -       -       pipe
> #  flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
> #
> #scalemail-backend unix -       n       n       -       2       pipe
> #  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
> #  ${nexthop} ${user} ${extension}
> #
> #mailman   unix  -       n       n       -       -       pipe
> #  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
> #  ${nexthop} ${user}
>
>
> Can I use .sh script here?

Yes. Read "man 8 pipe".

        Wietse
Reply | Threaded
Open this post in threaded view
|

Where i can see the received emails

Arora, Sumit
I have done the basic configuration of postfix on my fedora10.

Can anybody tell me where I can see the received emails.
Do I need to setup any database for storing emails?

I just want to be sure that I'm getting emails or not.

Thanks,
Sumit Arora
Reply | Threaded
Open this post in threaded view
|

Re: Where i can see the received emails

Patrick Ben Koetter
* Arora, Sumit <[hidden email]>:
> I have done the basic configuration of postfix on my fedora10.
>
> Can anybody tell me where I can see the received emails.

Usually /var/mail/<username>.

> Do I need to setup any database for storing emails?

No.

> I just want to be sure that I'm getting emails or not.

Check the log. Postfix logs what it does.

p@rick

--
All technical questions asked privately will be automatically answered on the
list and archived for public access unless privacy is explicitely required and
justified.

saslfinger (debugging SMTP AUTH):
<http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>