Jump to content
Welcome to our new Citrix community!
  • 0

Sending Mails form Xen Server Host (SSMTP?)


Question

Hello,

I'd like to send mails directly from my Xen Server Host, but if i try to do this by using the command 'mail', i get an error as follows:

# mail

-bash: mail: command not found

as i can see, there is SSMTP installed on xen server host. do i have to enable / activate / install anything else, than just to configure ssmtp.conf properly?

thank you for every input,
CH1981

Link to comment

10 answers to this question

Recommended Posts

  • 0

Installing a simple MTA is pretty basic using yum and the CentOS-Base repository already included.

edit /etc/yum.repos.d/CentOS-Base.repo

and add the line (or modify if it's already there):

enabled=1

at the end of the [base] block. This enables the repo.

yum search mail

should return some available RPMS, then

yum install mailx
or
yum install mutt

are two possible MTAs (mutt is more useful if you intend to email attachments).

reverse your yum repo changes, disabling the CentOS-Base repo, and you're done.

Link to comment
  • 0

An extra note... the older versions of some MTAs, in particular mailx cannot send mail directly to an smtp server (-S smtp=<server>) option is not available.

The options there are to also install a mail server on the xen host (yum install postfix) and configure it to use your mail relay (relayhost=[ip.of.smtp.relay] in /etc/postfix/main.cf), or to install a newer version of mailx which can send directly using the smtp=<server> option.

Link to comment
  • 0

 

Installing a simple MTA is pretty basic using yum and the CentOS-Base repository already included.

edit /etc/yum.repos.d/CentOS-Base.repo

and add the line (or modify if it's already there):

enabled=1

at the end of the [base] block. This enables the repo.

yum search mail

should return some available RPMS, then

yum install mailx
or
yum install mutt

are two possible MTAs (mutt is more useful if you intend to email attachments).

reverse your yum repo changes, disabling the CentOS-Base repo, and you're done.

 

I tried what you said, and I got these results.  Any idea what I did wrong?

 

[root@ARCHXEN10 ~]# yum search mail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http or file.
 Eg. </html>/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
 

Thanks in advance,

Bob

Link to comment
  • 0

I found in internet this script which works perfectly on XenServer 6.5 - http://www.tutorialspoint.com/python/python_sending_email.htm

 

#!/usr/bin/python

import smtplib

sender = 'from@fromdomain.com'
receivers = ['to@todomain.com']

message = """From: From Person <from@fromdomain.com>
To: To Person <to@todomain.com>
Subject: SMTP e-mail test

This is a test e-mail message.
"""

try:
   smtpObj = smtplib.SMTP('localhost')
   smtpObj.sendmail(sender, receivers, message)        
   print "Successfully sent email"
except SMTPException:
   print "Error: unable to send email"

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...