Configuring smtp to work through a How to send mail without the mail server.

    Most webmasters are required to be able to configure email service on which a host. They zachastuyuv kachestvepochtovoy service exploit server sendmail. But of all of its features, Web master affect only send messages. If you have limited resources on the server, and do not want to spend to sendmail Total vise in the system, you can install the system program ssmtp. This program allows you to send mail to a hair's breadth, as sendmail, its advantage over the sendmail is that it is not hanging in the system and starts automatically only when it will be necessary to send a message

In this article, there will be discussion about how you can customize ssmtp chtoby she worked through the Google server

How it works

As things stand, that the * NIX-world the very first program to send mail was sendmail. This server was a very long time the de-fakto.Sendmail- a universal kombain, with which you can perform a number of functions. It uses to send and receive mail SMTP protocol

   Then, gradually formed the concept of MTA (MailTransferAgent). MTA - is a special element for transmitting email, it is used solely to process e-mail delivery. Any program that is used to transmit e-mail messages, call MTA- programs. 
   In addition to sendmail, in systems * NIX nachali appear and many other MTA programmy. These include EXIM, postfix, and most important for us ssmtp. But Linux sisteme long ago accepted the fact that for the transmission of e-mail messages should be used imennosendmail. Because of this, when Linuxsistemu put any MTAprogramma, it starts to create the files links / usr / sbin / sendmail and / usr / lib / sendmail, they point the way to the desired program. In the example below these files point to the program ssmtp.

$ Cd / usr / sbin
$ Ls -l | grepsendmail
lrwxrwxrwx 1 root root 5 2011-04-07 03:09 sendmail -> ssmtp

   In fact, the program is simply ssmtp console client SMTP, in stdin it can receive the sent email, and can also connect to external SMTP server and send him e-mail messages. Following this, we can understand that ssmtppochti no different compared to other e-mail clients, such as KMail and Thunderbird.

It is important to note:
   To send a message does not necessarily include on a permanent basis by a demon (he used to receive it). Therefore, a simple program ssmtpeto

   In Linux sistemah while sending emails any client (say interpreter PHP) by default starts to execute the program / usr / sbin / sendmail, sending through a regular flow of mail text and headlines. In our case, it's just a link, and it points the way to the program ssmtp. Because of this email will be sent using ssmtp

How to configure it.

   So, first you need to create a mailbox Gmail. Letters to be sent via ssmtp, will come in the name of the destination mailbox Googlemail
Suppose we already have a mailbox Let's start to configure the client using the mailbox
To get started, install ssmtp. If you Debian to for this command is used

$ Sudoapt-get installssmtp

Once we installed it, you need to configure the file /etc/ssmtp/ssmtp.conf. He should look to ssmtp worked through GoogleMail

mailhub = 465

AuthUser = myemail
AuthPass = parol_k_pochtovomu_yaschiku

rewriteDomain =

hostname =

FromLineOverride = YES


   Following you need to configure / etc / ssmtp / revaliases. In this file, you need to register on which users can send e-mail. Usually prescribed users rooti www-data, so that the server can send mail. In the file you need to enter the data of the line:

root: 465
www-data: 465

   And, you can assume that all the manipulations over. 
In order to test the program, you can try to send the message using PHP. Create a script called send_test_email.php.
Blend in the following:

<? php
mail ("", "earned", "This is a test \ n ssmtp");
 The script can be done using the browser.