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 -> Cli Sending Email...

Reply to this topicStart new topicStart Poll

> Cli Sending Email..., trying to send email from a cli
cx_jx
Posted: Aug 10 2010, 02:39 PM
Quote Post


Newbie
*

Group: Members
Posts: 7
Member No.: 2436
Joined: 13-February 07



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
PMEmail Poster
Top
cx_jx
Posted: Aug 15 2010, 10:39 AM
Quote Post


Newbie
*

Group: Members
Posts: 7
Member No.: 2436
Joined: 13-February 07



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


PMEmail Poster
Top
Saint2000
Posted: Aug 15 2010, 05:40 PM
Quote Post


Junior Member
**

Group: Members
Posts: 45
Member No.: 2525
Joined: 3-May 07



And if you try the sendmail command as root?
PMEmail Poster
Top
cx_jx
Posted: Aug 16 2010, 06:27 AM
Quote Post


Newbie
*

Group: Members
Posts: 7
Member No.: 2436
Joined: 13-February 07



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
PMEmail Poster
Top
Saint2000
Posted: Aug 16 2010, 12:19 PM
Quote Post


Junior Member
**

Group: Members
Posts: 45
Member No.: 2525
Joined: 3-May 07



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?
PMEmail Poster
Top
cx_jx
Posted: Aug 16 2010, 01:21 PM
Quote Post


Newbie
*

Group: Members
Posts: 7
Member No.: 2436
Joined: 13-February 07



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
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | XMail Server | Next Newest »

Reply to this topicStart new topicStart Poll