Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm setting up my own VPS, till now I've managed to set up a few domains on it as virtual hosts. The sites are working fine, and now I need to add email accounts to each of them. I also have webmin and virtualmin installed on the server.

So I have domains which work, example:

  • www.mydomain1.com

  • www.mydomain2.com

Now I want email accounts, accessible online via squirrelmail, and also via thunderbird or outlook on the desktop.

Example:

  • james@mydomain1.com
  • rita@mydomain1.com

  • info@mydomain2.com

  • sales@mydomain2.com

and so on.

I would appreciate some guidance as to how I can achieve this, I've already installed postfix, dovecot, spamassassin, and squirrelmail via apt-get. What is my next step, I can't seem to find quite the right tutorial for this scenario I've got, although it must be a very common one.

Thanks!

share|improve this question
    
Did you find a solution? –  smoreno Dec 7 '13 at 4:33

1 Answer 1

Here it is an example

If you use sendmail, place your domains in /etc/mail/local-host-names and /etc/mail/generics-domains.
After that in the /etc/mail/genericstable add your user's emails in this format:

myuser myemail@domain.dom
myotheruser myotheremail@otherdomain.dom

In the /etc/mail/virtusertable add the reversing:

myemail@domain.dom myuser
myotherdomain@otherdomain.com myotheruser

In the /etc/mail/sendmail.mc use this config, changing the domain name to your primary domain:


VERSIONID(`setup for linux')dnl  
OSTYPE(`linux')dnl  
define(`confDOMAIN_NAME', `myprimarydomain.dom')dnl 
define(`SMART_HOST',`myprimarydomain.dom')dnl
define(`SMTP_MAILER_MAXMSGS',`40')dnl
define(`confDEF_USER_ID',``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`PROCMAIL_MAILER_FLAGS', `mSDFMhun')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
dnl define(`confPRIVACY_FLAGS', `goaway,nobodyreturn,authwarnings,novrfy,noexpn,restrictqrun')dnl
dnl define(`confPRIVACY_FLAGS', `goaway,nobodyreturn,authwarnings,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl

DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl

dnl INPUT_MAIL_FILTER(`greylist',`S=local:/var/run/milter-greylist/milter-greylist.sock')dnl
dnl INPUT_MAIL_FILTER(`greylist',`S=inet:3333@localhost, F=T, T=S:1m;R:2m;E:3m')dnl

define(`confMILTER_MACROS_CONNECT', confMILTER_MACROS_CONNECT`,{daemon_port}')dnl
define(`confMILTER_MACROS_HELO', confMILTER_MACROS_HELO`,{verify},{client_resolve}')dnl
define(`confMILTER_MACROS_ENVRCPT', confMILTER_MACROS_ENVRCPT`,{client_resolve}')dnl
define(`confMILTER_MACROS_CONNECT', `H, j, _, {daemon_name}, {daemon_port}, {if_name}, {if_addr}, {client_addr}')dnl
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen},{auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr},{md_tag}')dnl
define(`confMILTER_MACROS_ENVRCPT', `{greylist}')dnl


INPUT_MAIL_FILTER(`spamassassin', `S=unix:/var/run/spamass-milter/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl
define(`confMILTER_MACROS_ENVRCPT',`r, v, b, Z')dnl

define(`confAUTH_MECHANISMS', `LOGIN PLAIN  DIGEST-MD5 CRAM-MD5')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN  DIGEST-MD5 CRAM-MD5')dnl

define(`confCACERT_PATH',`/etc/pki/tls/certs')dnl
define(`confCACERT',`/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT',`/etc/pki/tls/certs/sendmail.pem')dnl
define(`confSERVER_KEY',`/etc/pki/tls/certs/sendmail.pem')dnl
define(`confCLIENT_CERT',`/etc/pki/tls/certs/client.crt')dnl
define(`confCLIENT_KEY',`/etc/pki/tls/certs/client.key')dnl
define(`confCRL',`/etc/pki/tls/certs/revoke.crl')dnl
define(`confTLS_SRV_OPTIONS', `V')
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -T -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`dnsbl', `relays.ordb.org', `Rejected - see http://ordb.org/')dnl
dnl FEATURE(`dnsbl', `bl.spamcop.net')dnl
dnl FEATURE(`dnsbl', `sbl.spamhaus.org')dnl
dnl FEATURE(`dnsbl', `blackholes.mail-abuse.org')dnl
dnl FEATURE(`dnsbl', `relays.mail-abuse.org')dnl
LOCAL_DOMAIN(`myprimarydomain.dom')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
define(`confLOG_LEVEL', `14')dnl

When you finished, restart sendmail.

share|improve this answer
1  
The above didn't work for me :(. But I did learn a bit about sendmail, so thanks :) –  fuzzyanalysis Apr 20 '13 at 13:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.