Is there a quick and dirty utility to send emails (does not need to be part of a package to receive and view email, in fact, I'd prefer if it wasn't).
Ideally I would like to be able to send attachments as well.
Mike
---------- Post updated at 04:29 PM ---------- Previous update was at 03:22 PM ----------
OK I am shocked this actually works! I am almost there. I need to "wrap" the base64 in something so the mail client recognizes it. ---------- Post updated at 04:59 PM ---------- Previous update was at 04:29 PM ----------
Getting closer although the mail is still plain text.
Mike
Last edited by Michael Stora; 07-17-2014 at 08:37 PM..
Have you got the mail or sendmail commands available? You can feed these with input files. Have a read of the manual pages. There are configuration files to edit to get them to relay the mail correctly, but that should be pretty easy and it would make your code much simpler.
Usually, sending email from the prompt involves using a mail-transport-agent like sendmail or mailx. If you don't have one, setting up your own mail server isn't exactly "lean", so I might suggest installing ssmtpd instead -- a "stub" MTA which just forwards to whatever real mail server you configure it to.
OK. I got it! Works great. Had to read some RFC documents. Got a clue where to start from a mention of RFC 2822 in a rejection message and from there I found the RFCs for MIME.
Sending mail with attachments from a minimal linux system with no mail client!
Mike
Last edited by Michael Stora; 07-21-2014 at 07:31 PM..
These 2 Users Gave Thanks to Michael Stora For This Post:
Well done for persevering with this and thanks for updating the thread too.
I've proved it works on RHEL 6 too. We have some servers where we don't want to allow mail for users to work, but we still need to get alerts out. Just installed the telnet client and it fired up. I had to increase the sleep counts and send a HELO first, but that may just be my relay server requirements.
Well done for persevering with this and thanks for updating the thread too.
I've proved it works on RHEL 6 too. We have some servers where we don't want to allow mail for users to work, but we still need to get alerts out. Just installed the telnet client and it fired up. I had to increase the sleep counts and send a HELO first, but that may just be my relay server requirements.
Good job!
Robin
I should say HELO or EHLO and will add that. I should also add Date: to the extended headers (beginning of the body) under RFC 2822. In addition recipients are assumed to be bcc (by my server?). Those that should be To, CC, and BCC need to be spelled out in the extended header as well. BCC is frounded on by my employer so I'm going to add some code.
In doing more reseach it appears that subject is usually the last line of the extended header and that a blank line separates the extended header from the true "body" which is why many sources say you need a blank line after subject.
Mike
This User Gave Thanks to Michael Stora For This Post:
For this type of script I would use expect. If you're connecting to an email host that either not too close or, has a bad connection. The sleep statements might not work to well.
Using autoexpect to create the skeleton for communications with the email server would ensure that you wait for a response. It's also very configurable as far as what you can do if the server doesn't respond as expected. I. E. the mail server responds that your recipient doesn't exist, etc...
Here's a the script autoexpect generated from a command line connection. Note that the scripts generally work route off the hop. Some "massaging" needs to be done. Also, I remove almost ALL the -exact to take into account variations on responses.
----------------------------------------------------
Forgot to mention. To make things much easier, you can use variables for the input(send).
Just 2¢ worth of a thought.
Last edited by mph; 07-22-2014 at 03:43 PM..
Reason: Additional thought
Dear users,
I have Linux server whose versions are Suse 10 SP 3 and Suse 11.
I am trying to send email from these servers to my GroupWise email account.
In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Hello,
Trying to get a bash for files received on daily basis and want to copy those files to different directory and send an email notification if file exists then send the file counts else Alert with no file received.
FileName format: DailyTransaction_2015-03-09_ 200.csv before 200 their is... (1 Reply)
Hi,
I have one requirement to send email to email id which is having # ( in the begining of the email id).
I'm using mailx command to send an email. But not receiving those emails, but email status is showing email sent successful.
Code which i'm using is :
cat file1.txt | mailx -s... (3 Replies)
hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version).
i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010).
a. i cant see a list of the contacts,... (0 Replies)
Hello ,
I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them .
I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Hello everyone
I have a problem and I need your help:
I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server.
I need send an email from Solaris servers preferably using Centos4 email server.
I have no mail service configured in my Solaris computers (1 Reply)
Hi All,
How do I send an email using malix where email address contains a #.
I have a email address like this : #test@test.com
I want to send email like malix -s "TEST" #test@test.com < SOMEFILE
I tried \# but doesn't work. Please let me know how we can achieve this?
I am in... (1 Reply)
Hi
A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as
" usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)