LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-11-2015, 01:53 AM   #31
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643

Well, yeah, you don't need the postfix vmailbox stuff if you aren't using postfix's virtual transport (that's why I moved to dovecot for delivery in the first place - to avoid duplicating all the user db stuff - along with some mailbox performance improvements with indexing-on-delivery).
Your transport will need some way to know where to put mail.
You will also need to work out how to handle the uid/permissions issues - for fairly obvious reasons mail processing tools get quite concerned about permissions when processing arbitrary chunks of code submitted to public-facing systems.

Last edited by descendant_command; 11-11-2015 at 01:56 AM.
 
Old 11-11-2015, 09:31 PM   #32
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Ok think I'm getting somewhere, basic crude test program:

Code:
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>

using namespace std;

int main()
{
string email="";

char a=' ';

while(true)
{
   a = getchar();
   
   if(a==EOF)break;

   email+=a;
}


fstream fout("/localdata/mail/vmailbox/rohan.loc/test/cur/ThisIsTotallyNotValidFormat.txt",ios::out);

fout<<email;

fout.close();

    return 0;
}


Master.cf line:
Code:
customtspt   unix - n n - - pipe
  flags=DRhu user=vmail:vmail argv=/localdata/apps/customtspt/customtspt
And changed virtual_transport to customtspt. I'll probably come up with a better name than that but just testing for now.

At this point any mail sent to any valid email address gets put in the test@rohan.loc inbox, and I can open it. I even tested an attachement. So I'm off to a good start, at least I got the very basic conceptual stuff working.

Now to make sure it goes to the right mailbox, what is the best way to determine the email it's addressed to, do I actually parse out and find the From field, or is there some kind of variable that gets passed or something?

Obviously I'll have to use the proper Maildir format too, but from the looks of it you can actually get away with pretty much anything, but I'll still follow the proper standard. I found a doc that explains it well here:

http://cr.yp.to/proto/maildir.html
 
Old 11-11-2015, 11:38 PM   #33
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Look at your dovecot transport - you can pass the recipient info that postfix has, as the To: address in the message body is not necessarily the same as the envelope recipient (in the case of CC & BCC, aliased, redirected etc).

Before you get too far down the rabbithole - have you tried just using an alias?

Last edited by descendant_command; 11-11-2015 at 11:43 PM.
 
Old 11-12-2015, 12:03 AM   #34
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Oh right I see that, so I just need to make my program accept that as an argument. This feels safer than parsing out what's in "to:" as spammers sometimes do really weird things to email fields so don't want to rely on that.

Not sure what you mean by just using an alias, that's not what I'm trying to do. I can already do aliases in the /etc/postfix/virtual.txt file but I don't really need to make use of those for this particular email setup. I just need to be able to have full control over the delivery process for each mailbox, because of the fact that I have a couple special ones that need to do something totally different. With my program I will make a rule syntax/format and each mailbox will have it's own rule file. For now I will work on just making very basic delivery working, and then add features as I go.
 
Old 11-12-2015, 12:38 AM   #35
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by Red Squirrel View Post
Not sure what you mean by just using an alias, that's not what I'm trying to do. I can already do aliases in the /etc/postfix/virtual.txt file but I don't really need to make use of those for this particular email setup. I just need to be able to have full control over the delivery process for each mailbox, because of the fact that I have a couple special ones that need to do something totally different.
Not virtual aliases - the virtual transport specifically ONLY does mail delivery, not piping to external commands or anything else.
I'm talking about local aliases (/etc/aliases or a custom alias db) which uses the local transport - which CAN do what you want.
Really, read the postfix docs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Dovecot - password file for virtual email users compused Linux - Software 3 03-13-2013 03:58 AM
Postfix + Dovecot + virtual users without a database? MheAd Linux - Server 6 10-18-2011 08:45 AM
create postfix virtual users without dovecot obayda86 Linux - Server 1 05-29-2010 10:41 AM
postfix, dovecot, mysql virtual users problem chrismottershead Linux - Server 1 01-04-2010 07:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration