# Postfix relay



## Seeker (Aug 10, 2009)

On my server, I have installed Postfix with SASL and SSL(TLS) Encryption on port 25, for remotely sending email. And courier-imap over SSL for remotely retrieving mail.

I access that server from my laptop. Works excellent!


----------



## Seeker (Aug 17, 2009)

How do I make all emails sent via postfix to have it's copy in sent folder for that user?

I have in main.cf

```
home_mailbox = Maildir/
```

But there are just new, cur, tmp folders.


----------



## ironmikie (Aug 18, 2009)

Don't you have a .Sent directory there. If not it might be created and used by the email client you use. For me that is thunderbird.


----------



## Seeker (Aug 18, 2009)

Everything works fine, if I use mail client.
I start it up, set my login credentials.
Access server, *create Sent folder in mail client*, and each sent mail is stored in that folder.

But, *I don't wana use mail client*

I wana each email *sent* by user from localhost(via telnet) OR relayed for that user from somwhere else(remotly from laptop - very basic client used - poppeeper) to be in *sent folder*.

I did this:

```
# maildirmake -f Sent Maildir
```
Which creates a subdirectory named .Sent(period character is designated as a hierarchy separator), that has the usual tmp, new and cur dirs, within an existing Maildir
.Sent is then Maildir++ format.

But what now?
How to make each sent mail(by methods above) to be in ../Maildir/.Sent/cur ??


----------



## DutchDaemon (Aug 18, 2009)

Postfix is an SMTP server. The kind of solution you want (maintaining users' mailboxes) is basically handled by an IMAP server or a local delivery agent. 

Only incoming mail (destined for a local mailbox) will be routed to a user's mailbox using a local delivery agent (lmtp, mail.local, postdrop, procmail, etc.). 

But making a copy of _outbound_ email and dumping it in the _correct user_'s Maildir ... (which Postfix doesn't know about) .. I don't think so. 

That is typically something that's done by an email client over an IMAP session, or by command-line mailreaders like Mutt/Pine, etc., which can also be configured to store sent mail in a specific folder.


----------



## Seeker (Aug 18, 2009)

DutchDaemon said:
			
		

> ...But making a copy of _outbound_ email and dumping it in the _correct user_'s Maildir ... (which Postfix doesn't know about) .. I don't think so.


Ah, I see... if I wana do that, then I need to continue to use mail client.


			
				DutchDaemon said:
			
		

> That is typically something that's done by an email client over an IMAP session, or by command-line mailreaders like Mutt/Pine, etc., which can also be configured to store sent mail in a specific folder.



But how come, than, when using poppeeper, which isn't avare of sent folder.
When I send through my gmail account using poppeeper, it is stored in gmail sent folder.
But when sent through my email server using poppeeper it is not stored in sent folder.

poppeeper sends mail using only SMTP(no IMAP used when sending, which would manage mailbox and store that outbound mail into sent folder.)

Both my server and gmail are using IMAP protocol


----------



## DutchDaemon (Aug 18, 2009)

You can't easily compare Gmail/Google (which hacked together their own operating system, file system, and, very likely, smtp / imap implementations and mail delivery/storage protocols) with 'regular' applications. 

Moreover, I believe you need to authenticate to the Gmail smtp server first (if I'm not mistaken), which makes the connection between sent mail and the user's local storage much easier to attain. 

But I can assure you that there've been a lot of people writing a lot of purpose-built code for that to materialise.


----------



## Seeker (Aug 18, 2009)

Yes, authentication is a must, with google's gmail and is all over SSL / TLS.

So to summarize, I would have to pair postfix SMTP in it's config file, with handwritten (shell) script to achieve what I want. 
Right?

Each auth user (SASL), that relays through postfix SMTP, gets outbound mail copied in it's sent folder, by that custom handwritten script.


----------



## DutchDaemon (Aug 18, 2009)

Let's say that I'm not aware of any _built-in_ functionality in Postfix to clone outgoing email to the mailbox of a user. There are anti-spam programs that can copy all outgoing email and send it to one account (e.g. postmaster, root), so I guess a script could be devised to intercept these cloned emails and send them to a different location, but it's likely to run under root privileges and interfere with file/mailbox ownerships and lock files. And you'd still need to know which outgoing email belongs to which user, unless there's a 100% certainty that that user is correctly identified in the Return-Path.

Make them all use webmail, I say


----------



## Seeker (Aug 18, 2009)

I am 100% certain which user "is", because they must authenticate(SASL-pam) prior to sending mail through SMTP.
Webmail or any other mail client, achieve what I want.
Thing is there is no human users on my system except me. 

Well, then I will ride on that capability of anti-spam programs to "catch" outgoing mail and do with it, whatever they/I want. 
Thanks.


----------

