Emails are not working on server?

Emails are essential tool / facility on web server to manage all communications among users.

Here are few issues:

1. Send mail function is not configured
2. No responsible mail server service on web server
3. Email port blocked
4. SMTP service
5. IP blacklist

How to fix:

1. Check Mail server (sendmail or postfix) on server

#  ps -aux  (check all processes for mail service)
#  chkconfig –list (check mail service)
#  rpm -qa | grep sendmail
#  rpm -qa | grep postfix

2. If there is no Mail server then install

#  yum search sendmail
#  uname -i (check server arch.)
#  yum install sendmail.x86_64 sendmail-cf.x86_64 sendmail-devel.i386 sendmail-devel.x86_64 sendmail-doc.x86_64
#  chkconfig –list
#  ps -aux
#  service sendmail start

3. Now create a test email.php file

<?php

$to = "test@gmail.com";
$subject="Testing mail....";
$message="Welcome to svnlabs.com";
mail($to, $subject, $message);

?>

4. If you still no mail yet… 🙁  Check mail logs

#  tail -f /var/log/maillog
#  less /var/spool/mail/root

5. Finally check network setting for DNS & SMTP

#  vi /etc/sysconfig/network
#  service sendmail restart

Configure sendmail see here

Alternative: PHP Gmailer

Gmailer allows sending outgoing mail via Gmail or Google Apps accounts.

* SMTP server address = ‘smtp.gmail.com’
* SMTP server port =’465′
* SMTP username and password = username & password registered at Gmail.
* Whether or not SSL should be used = SSL enabled
* From: email address and Sender’s name for outgoing mail.

Must Read…

https://www.svnlabs.com/blogs/linux-mail-servers/

https://www.svnlabs.com/blogs/no-route-to-host/

Formal education will make you a living. Self-education will make you a fortune. 😉

Theory About Bulk Emails

Electronic mail (e-mail), is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks.

An email message consists of three components, the message envelope, the message header, and the message body. The message header contains control information, including, minimally, an originator’s email address and one or more recipient addresses.

Amazon Simple Notification Service Command Lines

The size of email (Total amount of data to send) is determined using above components.

Mail delivery agent
A mail delivery agent or message delivery agent (MDA) is a computer software component that is responsible for the delivery of e-mail messages to a local recipient’s mailbox.

Message transfer agent
A mail transfer agent (MTA) or mail relay is software that transfers electronic mail messages from one computer to another using a client–server application architecture. An MTA implements both the client (sending) and server (receiving) portions of the SMTP.

Comparison of mail servers

Common Question among Friends…
How many email I can send through my mail server?

Well, Everything depend on your server including “EMail Server”…. we can say all depend on our budget 🙂

The number of emails you can send depend on… “Server’s Bandwidth”, “Size of Messages”, “Expected number of failures”…..

Number of seconds to send all data = Total amount of data to send / Bandwidth per second

Some Hosting packages (# emails depend on server):
Budget Shared Hosting Plans – 100 emails per hour
Unlimited Hosting Plans – 100 emails per hour
Advanced Shared Hosting Plans – 250 emails per hour
Professional Shared Hosting Plans – 500 emails per hour
Resellers – All Reseller Servers have a 500 email per hour
Semi-Dedicated Servers – 5000 emails per hour
Cloud VDS – No Limit
Dedicated Servers – No Limit
Enterprise Cloud Servers – No Limit

Solution:

PowerMTA – This is a product from port25.com specifically a mail delivery backend that handles email delivery, inbound bounces & replies, reporting & load balancing.

System Requirements for PowerMTA:

Minimum recommended production hardware
CPU: Single Dual Core, 3.00 GHz or better
RAM: 2GB
Disk: 2 or more in RAID 0 (striping)
Network: 1Gb Ethernet

Features:

# Number of simultaneous connections
# Number of messages per connection
# Number of delivery attempts per hour (throttling)
# Retry period and bounce period
# Authentication method
# Latest version includes x messages per second delivery rate support.
# Ability to break connections of lower priority queues
# New IP address warm-up feature to help build reputation
# Ability to pause queues and delete or re-start
# Real-time reputation monitoring
# Command line statistics and analysis utility
# Web-based status monitoring
# Data export of statistics log (XML, CSV, HTML, etc.)
# API to statistics log (C, Java, Perl)
# Data can be accessed in real-time or batch mode.
# Statistics can also be retrieved on a “per job” or “Virtual MTA” basis.

Other Factors that effect Message delivery:

* Available free disk space
* Disk I/0 performance
* Disk fragmentation levels.
* Other network traffic
* Retry times
* DNS response times
* external connection availability
* Error modes of external mail servers
* Availability of destination servers

Source:
http://mikehillyer.com/
http://www.gordano.com/kb.htm?q=708
http://www.labnol.org/internet/email/gmail-daily-limit-sending-bulk-email/2191/
http://en.wikipedia.org/wiki/Comparison_of_mail_servers

Open source – Port25

If you have trouble getting the PHP’s mail() function to work on your server.
If the function returned true, but never send the emails to target account.
Some ISP’s block port 25 (mail port), so you can’t send directly but you can send indirectly using your ISP’s mail server. 😉

Many email providers keep lists of IP addresses and block incoming mail, or move it immediately to a junk/spam folder.

Amazon Simple Notification Service Command Lines

There are some Open Source solutions to filter your mail problems..
You can check Open Source MTA here http://en.wikipedia.org/wiki/Comparison_of_mail_servers

Here list some MTAs as

  1. postfix
  2. qmail
  3. exim
  4. sendmail

Above MTA don’t handle integrated reporting, bounce management, and spam management, reporting.

PowerMTA: PowerMTA (this is not open source) provides the unique features and capabilities required by email service providers and enterprises to maximize the effectiveness of email marketing and customer communications, handle integrated reporting, bounce management, and spam management, reporting etc.

http://www.port25.com/products/prod_features.html

Linux Mail Servers

Manual Settings
~~~~~~~~~~~~

Mail Server Username: no-reply+domain.com
Incoming Mail Server: mail.domain.com
Incoming Mail Server: (SSL) host200.hostmonster.com
Outgoing Mail Server: mail.domain.com (server requires authentication) port 26
Outgoing Mail Server: (SSL) host200.hostmonster.com (server requires authentication) port 465
Supported Incoming Mail Protocols: POP3, POP3S (SSL/TLS), IMAP, IMAPS (SSL/TLS)
Supported Outgoing Mail Protocols: SMTP, SMTPS (SSL/TLS)

Warning: Changing MX to something besides domain.com will prevent us from managing your mail. The email will no longer be sent to this server.

Increase RAM size
~~~~~~~~~~~~~~

Some time there is problem with kernel.. as rams physically is 8GB. The reason for 3GB RAM is kernel not updated, so the high volume memory is not recognized. Try this command to update ram size:

# yum install kernel-PAE

http://www.cyberciti.biz/tips/category/mail-server