Sending mail from the command line not working using sendEmail

Sending mail from the command line not working. On my Mac I have installed a very simple mail server application called sendEmail.  More info here:  http://freshmeat.sourceforge.net/projects/sendemail/

 

It allows mail to be sent from the command line (Terminal I use).  I do this with a script, but am presently testing directly in Terminal as this is easier.

 

I used it for years with my present ISP and it worked fine.  I stopped using it about a year ago and now it does not work anymore.  I checked several reasons as to why it does not work, so far no luck. 


It could also be it is the change from OS 10.13 to10.15.

 

The error I get is on entering the password, it is:  -bash: syntax error near unexpected token `('

 

The password does indeed contain an ‘(‘ and an ‘)’.  See below, I changed it but stayed true to its basic structure.

 

As you can see below I escaped the whole sentence with the usual ‘ and ‘.  I also tried to escape it with \ and \ etc.  No difference I get the same error.

 

For your info:

-f = sender

-t = recipient

-s = isp address and port

-xu = the account we send from

-xp = password 

 

Here is the process till it stops.

 

mycomputer-Mac-mini:~ name$ sendEmail -f sender@xyz.com \

-t recipient@xyz.com \

-s sslout.isp.eu:465 \

-xu 123456 \

-xp ‘*(Fake6549Morefake)+123456’ \

-bash: syntax error near unexpected token `('

 

Now it could be I need to escape the PW different, but I tried all the ways I know and ‘ and ‘ is the most common and powerful one. “ and \ etc. where also tried. 

 

 

In the hope somebody has an answer to this conundrum. 

 

 

Posted on May 27, 2020 7:42 AM

Reply

Similar questions

8 replies

May 28, 2020 3:51 AM in response to ChangeAgent

While the underlying script may be in Perl, you are using Bash to execute it. I strongly suggest that you do not pass a password on the command line. For one thing, that will cause you no end of trouble with characters that have meaning to the shell. For another, once you do get it working, you are broadcasting that password throughout the entire system.


A better idea would be to store the password in a text file. That eliminates problems with shell interpretation. You can also use file system permissions to protect the password somewhat.


An even better idea would be to store the password in the keychain. That will require a little extra work to extract it from the keychain and will limit your scripting options a bit.

May 28, 2020 8:11 AM in response to ChangeAgent

It depends on how you are using the script. If you are running it manually, you can omit that parameter and enter it on the command line.


The perl script currently does not support saving the password in a text file. I guess 2009 was a different time, eh?


It would be easy to add this.


Adding keychain support would be more difficult.


I'm not sure why you are bothering with this at all. The built-in "sendmail" tool does most of this. It doesn't have keychain support. You could try some other tool. The first hit when I searched for "sendmail keychain" is this tool: https://marlam.de/msmtp/. It seems like it would do everything.

May 28, 2020 3:41 AM in response to ChangeAgent

Sorry, no. That was from another thread. It should have been a Perl escape page.

https://beginnersbook.com/2018/03/perl-string-escape-sequences/


BBEdit should generate the correct characters, but since it pastes into this forum with modified characters, it is hard to tell if you did it correctly.

If you create a code block (<>) button, it should paste without modification.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sending mail from the command line not working using sendEmail

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.