Postfix script configuration

Source: Internet
Author: User

Postfix script configuration

#! /Bin/bash

# This is a email server configure script

POSTFIX =/etc/postfix/mian. cf defines the location of the mail configuration file

DOVECOT =/etc/dovecot. conf defines the mail pop3 configuration file location

POSTFIXMBER = 26 value returned when a syntax error is checked

PROT = $ (lsof-I: 25 | awk 'nr = 2 {print $1} ') defines the process that occupies port 25

Netstat-nl | grep: 25 &>/dev/null check whether port 25 is enabled

If [$? -Eq 0]; then

Pkill-9 $ PROT 25 the occupied process is killed when port is occupied

Else

Echo "25 prot already release"

Fi

 

ForWRAP in {postfix, dovecot} install the mail server package

Do

Rpm-q $ WRAP &>/dev/null check whether the two packages exist

If [$? ! = 0]; then

Yum-y install $ WRAP

Else

Echo "$ WRAPalready install"

Fi

Done

 

Echo "myhostname = mail.baidu.com"> $ POSTFIX the Host Name of the email server

Echo "mydomain = baidu.com"> $ POSTFIX

Echo "myorigin = $ mydomain" >>$ POSTFIX the sender's suffix

Echo "inet_interfaces = all"> $ POSTFIX listener Port

Echo "mydistation = $ mydmain" >>$ POSTFIX the sender's DNS suffix

Echo "mynetworks = 0.0.0.0/24"> $ POSTFIX: sets which CIDR blocks are allowed to forward emails to external regions to the postfix.

Echo "mail_spool_directory =/var/spool/mail"> $ POSTFIX: Set the directory where emails are stored.

Postfixcheck check syntax

If [$? -Eq 0]; then

Service postfix restart Enable email service

Chkconfig postfix on

Else

Echo "postfix configure fileappear failed"

Exit $ POSTMBER check the configuration file failed and return the I mail storage effort Value

Fi

Echo "protocols = pop3" >>$ DOVECOT

Echo "listen = *" >>$ DOVECOT

Service dovecot restart

Chkconfig dovecot on

Install and configure the Postfix email service in CentOS 6.4

Install the mail server Postfix in CentOS 5.5

Build a Postfix email server for Red Hat Enterprise Linux 5.4

Postfix (authentication) for secure email servers in Linux)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.