Jump to content

Recommended Posts

 

I have installed ssmtp onto my ubuntu 11.04 server with php 5.3.5.

 

I have pointed the apache/php.ini to usr/sbin/ssmpt with the send mail path.

 

I am not sure i have configured my /etc/ssmpt/ssmpt.conf correctly though.

 

What i want is that the php mail() will send a simple email to which ever email address the relevant php script decides.

 

I already have a fully functioning email address held with bb-online which i can work with outlook to send and receive emails (i can even send myself emails from other email addresses). I have configured the /etc/ssmpt/ssmpt.conf to look like the following:

 

  GNU nano 2.2.6                                                    File: /etc/ssmtp/ssmtp.conf                                                                                                      Modified

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=contact-us@mydomain.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=server01.mydomain.com

# Where will the mail seem to come from?
rewriteDomain=mydomain.com

# The full hostname
hostname=sever01.mydomain.com

# Are users allowed to set their own From: address?
#YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

 

I'm really completely lost here, and i cannot find a good beginners guide to setting up email on a server. I'm with rackspace cloud  but their support (as amazing as it is) is helping either.

 

Where i have put mydomain.com, this the domain name that is pointing (with 'a record') to the ip address of my server at rackspace.

 

The SMPT for incoming and outgoin mail in outlook for the pop box at bbonline is serverX.bb-online.co.uk.... Should i be including this somewhere in the ssmtp.conf  ??

 

 

Any help here would be absolutely amazing. I havent been this lost since i started php!  :wtf:

I have pointed the apache/php.ini to usr/sbin/ssmpt with the send mail path.

 

No need to do that. ssmtp is a drop in replacement for sendmail. Leave your php.ini as is.

 

As for your configuration. As I said in your other thread. ssmtp is used to connect to a remote smtp server like gmail. You don't have a local server which it looks like your attempting to use. You can setup gmail to host your domains web server, then use a config like:

 

root=postmaster
mailhub=smtp.gmail.com:587
rewriteDomain=yourdomain.com
hostname=yourdomain.com
UseSTARTTLS=YES
AuthUser=youruser@yourdomain.com
AuthPass=yourpassword
FromLineOverride=YES

 

If you really wan't to run your own mail server (which I really would not recommend unless you know what you are doing) postfix is the most popular choice.

 

Thanks thorpe...

 

"I have pointed the apache/php.ini to usr/sbin/ssmpt with the send mail path."    << now removed, thus no path currently exists

 

/etc/ssmpt/ssmpt.conf  (contacted bb-online to get the correct outgoing port number [put as 22222 in this thread, actually something else]):

root = contact-us@mysite.com
mailhub=serverX.bb-online:22222
hostname=server01.mysite.com
rewriteDomain=mysite.com
AuthUser=contact-us+mysite.com
AuthPass=**************
UseSTARTTLS=yes
UseTLS=yes
FromLineOverride=yes

 

The php mail() still doesn't work. I found a tutorial vid :

 

Which stated that i needed to alter the /etc/ssmpt/revaliases file to include:

root:contact-us@mysite.com:serverX.bb-online:22222

 

The tutorial vid also says at the end to test the system is working at command line (using PuTTy):

echo "This is test email trying to use ssmtp" | mailx -s 'test' contact-us@mysite.com

When running this at command line i get '-bash: mailx: command not found'

 

 

I'm assuming this is because i do not have mailx installed, so i tried to install mailx, but got the following to choose from...

  mailutils 1:2.1+dfsg1-7build1
  heirloom-mailx 12.4-2
  bsd-mailx 8.1.2-0.20100314cvs-1

 

 

Any ideas why things are still not working?

 

 

 

 

Ok, i installed  bsd-mailx, rebooted.

 

tried:

echo "test email" | mailx -s 'test' contact-us@mysite.com

 

and got in return:

send-mail: Cannot open serverX.bb-online:25
Can't send mail: sendmail process failed with error code 1

 

i got in touch with bb-online. who said they have two ports they have available for this. I have now tried both but both return the error message....

 

Do you think this is something to do with my settings or those of bb-online?

 

Is there a permission i need to set on my server somewhere to allow outgoing mail, as in are the two ports i've been trying to use being blocked on my end?

 

Or is the error indicating that the system is trying to use sendmail and not ssmtp?

 

 

Wow.

 

Ok, one thing i have been overlooking though out all of the configuration of my linux server is that all ports are closed until opened by the admin.

 

As a result, the guys at rackspace said, i require a port opening through ip-tables to allow the mail to flow out of the server.

 

(why non of the guides said this i DO NOT know)

Does this meen it's working now? Otherwise, this line doesn't look right:

 

AuthUser=contact-us+mysite.com

 

This will need to be a valid username on the mail server. Sometimes this is just the username, sometimes it requires @servername.com to be appended (ie gmail).

 

Ok, i installed  bsd-mailx, rebooted.

 

You do not need to restart Linux when you install packages, it's not Windows. The only time you should ever need to restart your server is when you have installed a new kernel.

Hi thorpe sorry for the late response. I'm not sure exactly what was the stick in the mud. As i have been trolling through this whole process i have been putting together a guide to enable me to configure another server at a later date with no troubles. After following the guide which prompted me to use postfix and mysql to manage emails among a few other things, i think i may have got lost somewhere amongst all the settings.

 

I rebuilt my server from scratch, with only the essential kit (LAMP, webmin and ssmtp), configured with the security settings essential (ssh auth keys...etc) and tried again. It works, and these are the settings:

/etc/ssmtp/ssmtp.conf

root=master@mydomain.com
mailhub=server01.mypophost.co.uk:25 
rewriteDomain=mydomain.com
hostname=server01.mydomain.com
UseSTARTTLS=YES
AuthUser=email login provided by email host
AuthPass=*******
FromLineOverride=yes

 

/etc/ssmpt/revaliases:

root:master@mydomain.com: server01.mypophost.co.uk:25

 

Then install bsd-mailx to check:

apt-get install  bsd-mailx

 

Then test from cli:

echo “this is a test” | mailx -s 'Test' master@mydomain.com

 

 

 

 

Now do a test from a php script... The mail gets delivered, but with an odd behaviour...

 

All emails from my site are written multipart, however both outlook and hotmail only want to read the plain text version.

 

In the source of all emails sent:

Each email contains the following : "Content-Type: multipart/alternative;boundary=np4e984a350db71" and the boundries are correct further down the email which seperate the plain and html versions.

 

Also the emails read : "From: "www-data" <www-data@mydomain.com>"

 

 

However the subject of the emails are set by the php scripts and they have not changed since i was on a basic shared hosting server at bb-online??

 

 

Currently i am happy that i have finally got all my site working inc everything using zlib, but i will come back in a few days to try and resolve this email issue with the incorrect subject and basic header info. I think it must be a setting from ssmtp because when i run the test:

echo “this is a test” | mailx -s 'Test' master@mydomain.com

when logged into my server as root the subject of the email reads 'root'.

 

 

 

I think it may be something to do with passing the email onto bb-onlines server or something. The above test results in the following email source:

 

Return-path: <root@mydomain.com>
Envelope-to: contact-us@mydomain.com
Delivery-date: Fri, 14 Oct 2011 17:45:34 +0100
Received: from [31.777.777.203] (helo=server01.mydomain.om)
by server01.mypophost.co.uk with esmtpsa (TLSv1:AES128-SHA:128)
(Exim 4.69)
(envelope-from <root@mydomain.com>)
id 1REkt3-0001A9-Ff
for contact-us@mydomain.com; Fri, 14 Oct 2011 17:45:34 +0100
Received: by server01.mydomain.com (sSMTP sendmail emulation); Fri, 14 Oct 2011 16:45:33 +0000
From: "root" <root@mydomain.com>
Date: Fri, 14 Oct 2011 16:45:33 +0000
To: contact-us@mydomain.com
Subject: Test
X-Antivirus: avast! (VPS 111014-0, 14/10/2011), Inbound message
X-Antivirus-Status: Clean

this is a test

 

 

 

(i think when i have finally finish everything successfully i will put the guide i have put together up here for all to benefit from, i know i would have loved to see it exactly 7 days ago! and obviously in a .doc form for everyone on here to improve upon :) )

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.