XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum [Powered by Invision Power Board]
Printable Version of Topic
Click here to view this topic in its original format
XMail Forum > XMail Server > Cli Sending Email...


Posted by: cx_jx Aug 10 2010, 02:39 PM
Greetings,
I've searched the forums but not managed to get this working properly.

I want to send email from the command line (or more specifically a shell script executed from a UPS flag) so am trying to use the sendmail command....
I've tried testing with this:

~$ sudo sendmail -s test -t root@mydomain.net.au
[sudo] password for user: xxxxxx

I get this response:

cat: /etc/xmail/default_domain: No such file or directory

I can then type a message and end it with <ctrl>d and the message arrives at the destination but there is no subject and there is no domain after the sender root@

.....if I try the same sendmail command as a standard user (not sudo) I get permission denied:

My (Ubuntu) XMail server (Vers. 1.22) seems to be working perfectly well for SMTP & PO3 on my domain using a DynDNS custom domain service so that config is okay...

but, how (or why) do I set default domain as seems to be required for this internal /local mail?

...also, is there a sendmail option to use a "Subject:"

it also seems that my local user permissions are incorrect for command line emailing?

Any tips on shell scripting my UPS message appreciated as well.

Sorry to appear to be a bit useless at this... (but I'm also wanting to avoid wrecking my nicely working email/web/scanner/printer server...., its funny how you get to a point where its taken a long time to get things working right and it prevents you from being too daring).
Cheers,

Chris

Posted by: cx_jx Aug 15 2010, 10:39 AM
I have created a file named "default_domain" in /etc/xmail/ which contains "mydomain.net.au" and that gets rid of
the error:

cat: /etc/xmail/default_domain: No such file or directory

(not sure if that's the right thing to do dry.gif )

but I still have problems with permissions.....

...and I'm still not clued up on how to send a brief message on one line that I can incorporate in a script that runs if the power goes off.

Any clues?

Chris



Posted by: Saint2000 Aug 15 2010, 05:40 PM
And if you try the sendmail command as root?

Posted by: cx_jx Aug 16 2010, 06:27 AM
Hi,

If I type:

#~ sudo sendmail username@somedomain.net
enter root password xxxx
I can type a message here and finish it with ^d

The message will be delivered okay to the username@somedomain.net...
there is no To/From in the mail client.

I saw you had similar issues some time back as well...

Cheers,
Chris

Posted by: Saint2000 Aug 16 2010, 12:19 PM
Hi,

yes. I had some similar problems with sendmail. Here is some workaround, have you tried this? (change the sendmail with the workaround).

When you log in as root (cause xmail run`s as root) and type your command? (not as sudoer)

Which Linux do you use?

Posted by: cx_jx Aug 16 2010, 01:21 PM
Hi Saint

My Linux system is Ubuntu (8.04LTS)... there is no login for a root user as such on Ubuntu (security reasons) but sudo performs commands as a root user so that wouldn't change...

...I think that maybe there is a link between the permissions of the directories containing the xmail spool directories because (as you note) xmail runs with root permissions and if I try to do the above command as a normal user I get

user@B202:~$ sendmail user@somedomain.com
/var/lib/xmail/spool/temp/1281959824000.8346.B202.xxxdomain.net.au: Permission denied

which is the same error if I try to do the following as a non priv. user

user@B202:~$ ls -l /var/lib/xmail/spool/
ls: cannot open directory /var/lib/xmail/spool/: Permission denied

I look at the spool directories and they show these perm's.

drwx------ 25 root root 4096 May 17 2009 0

which tells me that only root can write in these directories or their children and I think maybe that is where the probs exists.... can I assume that sendmail (xmail) is working okay when it is called by a standard user since the user can execute the program but the user doesn't have the necessary permissions to write (or read) in the spool directory so sendmail refuses access to the spool and aborts with the error.

It would potentially create a security issue to alter /var/lib/xmail/spool permissions without good reason (....or not?)
Thanks,
Chris

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)