• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to install Postfix on FreeBSD 8.1 with MySQL?

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#1
Hi, I want to setup a mail server mainy postfix with mysql. I want to make my own php webmail interface to my website. I also want to use php to use the mail function to use these accounts too... to automate e-mails to users. Like when they register they will have to verify their e-mail address. I need to learn how e-mails get passed and how I can make my mail serve to send e-mails and receive e-mails.

Any good tutorials other then the manuals on here and postfix website. I already tried them and tried many other online tutorials I was able to follow the steps but still when I got to the point where I had to make mysql tables I got lost as to what information needs to be in that table. So I never got things to work at all. Yet, I was able to config postfix to use it's own mail maps system. I was able to send and receive mail.

Any ideas of some good resources that can teach me how e-mail servers work and how I need to set my postfix mail server?
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#3
I know how to install postfix... from the ports. I just don't know how to config it to make mysql work with postfix. I need to learn how e-mail servers actually work.. how e-mails gets passed back and forth.
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#5
killasmurf86 said:
This is about postgresql
http://wiki.bsdroot.lv/postfix:mailserver

In references section you will find links, that will lead you to postfix+mysql
But, I need something for mysql. Want to use postfix with mysql. I already got the server isntalled. I just need to install postfix and then config/set it up to use mysql properly. But I need to learn how e-mails get transferred. That way I can understand what I need to put in each table I create for the mysql table. I found many tutorials that explains each step on what to do. yet, they never explained the mysql database part where what information goes in what table. they just show you how to create the table and then they said done. I am sure I got it working with mysql but the part I failed was the data stored in the mysql tables weren't proper.

I can't find any tutorials or resources that explains each table made in mysql for postfix and what kind of information it needs. I want to shot multiple domain names e-mails.
 

graudeejs

Son of Beastie

Thanks: 666
Messages: 4,615

#6
I told you check out reference section.
It contains links to howto postfix+mysql... I wrote that howto based on other howtos

If you don't know what each table do, then you have to read postfix documentation, to find out.
That's what I did
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#7
graudeejs said:
I told you check out reference section.
It contains links to howto postfix+mysql... I wrote that howto based on other howtos

If you don't know what each table do, then you have to read postfix documentation, to find out.
That's what I did
I looked through them and currently going through them. Just one question which I can't find an answer too. What is an alias? I assume it's an e-mail name that you go by.
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#9
graudeejs said:
With aliases:
if you receive mail to wtf@alias.is, it can be delivered to hockey97@alias.is

In other words, You can have single mailbox, but multiple email addresses, that can receive mail (for example)

Also check definition of alias in dictionary: http://dictionary.reference.com/browse/alias
I know what the word means in the English language. Just didn't know what it means in the mail servers. I know spys uses an alias name or you can call it a code name. they don't give out their real names but other agents would call them by that alias name.

I followed this tutorial: http://www.purplehat.org/?page_id=8

I am stuck at the mysql maps. I don't know if I have to create a new account with mysql under the name postfix and give it a password. Where in the mysql maps it says password = postfix_sql_password I assume that I need to type the password there the one that was created with that account which is the account name named postfix. So would I need to make a new account with mysql and create that postfix account? If so should I look at the mysql installation guide on the same site to follow the steps in making the new account?
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#10
I just followed that tutorial on postfix using mysql. It isn't working. I created a mysql account for postfix. I then added the password to those mysql maps. Right now I can't send an e-mail out or get e-mails. Do I have to create some mysql data tables? to me it seems I have too. Yet, the tutorial dosen't show you how or show that you need too.
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#11
Is there any tutorials on how to connect mysql with postifx. The tutorial provided dosen't talk about how mysql syncs with postfix. Like how to name the mysql tables and what information to be stored in them in order for postfix to work properly.
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#15
I checked that out. I setup the system via : http://www.purplehat.org/?page_id=8 that tutorial. Would like to know of the mysql tables are the same name etc so there is no broken link. I can see some similar sql commands. I understand sql code. I just don't understand what is needed for each map and what does each map do. I am using mysql for those maps. I assume the virtual domain maps are the ones where you type in your mx record domain. For example: mail.domain.com this be the mx record of our domain name that will be used for e-mail.

That domain table in mysql has that domain and the active field. This be the place where you put all mail domain names that you want to handle mail for. The virtual mailbox maps would be where you put the user name and the physical location of their mail where it's stored on the server. So for example: user:bob / maildir:home/server/websites/domain/mail/bob Then you have a field if it's active. To allow mail or allow access to mail for that user.

Got one more question. What is supposed to be the hostname and domain name? Do I have to use the mx record domain? I created an Extra A record for my domain. It is something like gfserver1.domain.com I was thinking to use that as the hostname. Then domain flat out domain.com. So I have to assigned them or do I need to use a variable? This won't be the domains that postfix will use as the domain names for he address? For example from above like this: bob@gfserver1.domain.com it won't be like that correct? Like the user bob won't be using the hostname as the destination? Would if so then would I have to assign a variable to that config line? That way the domains will be variable based on requested or sent e-mails to my server?
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#19
Abriel said:
Did you check
Code:
/var/log/maillog
for any errors
Code:
postfix check
will be good too.
Abriel said:
i have in postfix
Code:
mydomain = domain.tld
myhostname = $mydomain
Thanks, I just tested my mail server and it still dosen't work at all. I tried using telnet using localhost with the port 25 and I can't log into the mail server. I followed all the tutorials on this page. The link provided about the mysql tables I followed everything of that but didn't do that backup domain in the domains table but part of that mysql map config the relay_domains map. I didn't create the backupmx field. So in that sql code in the mysql map I got rid of that part where it checks for the field to make sure it's equal to 1.

I am clueless as to why it's not working. In the domain table I have the domain like this: mail.domain.com that is the mx record domain I made for my domain name at my domain provider company's servers. Here is all the tutorials I followed and did everything exactly how they did it:

http://www.purplehat.org/?page_id=8 this for postfix config
http://www.purplehat.org/?page_id=7 : used this for Dovecot config/setup
http://www.freebsdonline.com/content/view/339/348/ : followed this to make my mysql tables. I only created the tables that the purplehat.org page id 8 had in their mysql maps the queries.

Here is what I followed from the freebsdonline.com tutorial:
Code:
CREATE TABLE alias
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#20
Abriel said:
Did you check
Code:
/var/log/maillog
for any errors
Code:
postfix check
will be good too.
I tried them. The maillog has 0 kb stored in the file. It shows nothing.

when I type that command I see nothing happening. Prints out nothing to the screen.
 

Abriel

Active Member

Thanks: 23
Messages: 119

#23
postfix is working, lets check if it allow connect:
Code:
telnet 127.0.0.1 25
and type
Code:
ehlo testmail.org
 

hockey97

Well-Known Member

Thanks: 3
Messages: 290

#24
Abriel said:
postfix is working, lets check if it allow connect:
Code:
telnet 127.0.0.1 25
and type
Code:
ehlo testmail.org
ok, tried it and this is what I got:

Code:
user# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ehlo testmail.org
Connection closed by foreign host.