[modified, smarter: ] How I send email from my OlinuxInoMaxi

Started by flavigny, October 26, 2012, 07:34:17 AM

Previous topic - Next topic

flavigny

Hello,
this post is for newbies on small linux, I apologize if it is not welcomed on this forum. Could moderator confirm?

I observed that my distro (yocto enriched by otavio) doesn't contain easy tool for exporting file (ftp, mpack, ...)
Last week, I wrote a fist draft (see below), now (added 20121028) a lighter one, without intermediate file. Type script in file: 'sendfi'
#!/bin/sh
echo -e "HELO your-machine\rMAIL FROM: <your-email>\rRCPT TO: <$1>\rDATA\rSUBJECT: file: $2\r\r`cat $2`\r.\r"|nc your-smtp-server 25

then, chmod +x sendfi
for sending a file, use:
./sendfi email-address  filename

Goodies: even without script, paste the next line:
echo -e "HELO your-machine\rMAIL FROM: <your-email>\rRCPT TO: <dest-email>\rDATA\rSUBJECT: file: file-name\r\r`cat file-name`\r.\r"|nc your-smtp-server 25

Of course, you have to fix the underlined-names!
Regards
PO.
------------------------------------ %X
for information, obsolete version:
so, I wrote a script 'sendfi':
#!/bin/sh
# send file to email
rm sendfi.txt
echo >> sendfi.txt HELO your-machine
echo >> sendfi.txt MAIL FROM: \<your-email\>
echo >> sendfi.txt RCPT TO: \<$1\>
echo >> sendfi.txt DATA
echo >> sendfi.txt SUBJECT: file: $2
echo >> sendfi.txt
cat >> sendfi.txt $2
echo>>sendfi.txt .
nc your-smtp-server 25 < sendfi.txt




LubOlimex

Hey flavigny,

It is more than welcome to explain basics in the forums. I bet somebody would find it useful even if not an Olimex customer.

If you wish to contribute with useful advices and findings you might consider submitting in the wiki. You can apply for account e-mailing here: info@olimex.com.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

bsrdjan