Skip to main content

Setting up mail server on Rackspace cloud server

  • strict warning: Non-static method view::load() should not be called statically in /var/www/vhosts/litzastark.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_argument.inc on line 744.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 159.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/vhosts/litzastark.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter_node_status::operator_form() should be compatible with views_handler_filter::operator_form(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/modules/node/views_handler_filter_node_status.inc on line 13.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /var/www/vhosts/litzastark.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
Posted in

For a couple of projects lately, I've had to set up a Rackspace cloud server with enough email capacity to send emails and to receive them to be processed by a script. Here are the steps I've followed:

  • Edited /etc/aliases to include the new email address, piped to the script that will process the emails, then run newaliases to load these aliases.
  • Ran hostname "[new-hostname]", which should change the setting without requiring a restart.
  • Installed postfix with yum install postfix, and ran chkconfig postfix on so that the process starts (and restarts on reboot).
  • Also installed telnet and mailx for testing tools.
  • Edit settings in /etc/postfix/main.cf and then restart postfix with /etc/init.d/postfix restart
    • myhostname
    • mydomain
    • inet_interfaces = all

Testing tools

Send a test message from the command line

  1. mail address@example.com
  2. Subject: test email from democloud.com
  3. test body of the email.
  4. .
  5. Cc:

Connect to the mail server using telnet

  1. telnet 127.0.0.1 25

Iptables

In order to have the right ports open, here are the iptables commands that I used:

  1. iptables -A INPUT -i lo -j ACCEPT
  2. iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
  3. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  4. iptables -A OUTPUT -j ACCEPT
  5. iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  6. iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  7. iptables -A INPUT -p tcp --dport 25 -j ACCEPT
  8. iptables -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
  9. iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
  10. iptables -A INPUT -j REJECT
  11. iptables -A FORWARD -j REJECT

After verifying that this worked, I saved the iptables settings so they'd run on restart: /etc/init.d/iptables save.