<div dir="ltr">As a backbone for sending emails thru GMAIL I am using old school ".bat" files and "mailsend.exe".<div><br></div><div><a href="https://code.google.com/p/mailsend/wiki/mailsendFAQ">https://code.google.com/p/mailsend/wiki/mailsendFAQ</a><br></div><div><br></div><div>I see it can also be used in Linux...</div><div><br></div><div>My only experience is running it as ".bat" files on Server 2012 R2.</div><div><br></div><div>In the first batch file:</div><div>>></div><div>email.bat <a href="mailto:yyyyy@gmail.com">yyyyy@gmail.com</a> <a href="mailto:receiver@yyyy.com">receiver@yyyy.com</a> "-ssl" 465 "-auth" <a href="http://smtp.gmail.com">smtp.gmail.com</a> "files of the day in PDF" "gmail password" C:\location of files<br></div><div>>></div><div><br></div><div>The file that looks for PDF files and attaches them to the <a href="mailto:receiver@yyyy.com">receiver@yyyy.com</a> email above.</div><div>And sends me a report with time and date of the event.</div><div><br></div><div>second batch file: email.bat</div><div>>><br></div><div><div>::@echo off</div><div>setlocal</div><div>:: defaults</div><div>set from=<a href="mailto:yyyyy@gmail.com">yyyyy@gmail.com</a></div><div>set to=<a href="mailto:aw@yyyy.com">aw@yyyy.com</a></div><div>set subj="File Attachment"</div><div>set serv=<a href="http://smtp.gmail.com">smtp.gmail.com</a></div><div>set auth=<a href="mailto:yyyyy@gmail.com">yyyyy@gmail.com</a></div><div>set pass=gmail password</div><div>set filepath=C:\location</div><div>set port=465</div><div>set ssl="-ssl"</div><div>set auth="-auth"</div><div>:: Arguments</div><div>if "%~8" NEQ "" (</div><div>set from=%1</div><div>set to=%2</div><div>set ssl="%~3"</div><div>set port=%4</div><div>set auth="%~5"</div><div>set serv=%6</div><div>set subj="%~7"</div><div>set pass="%~8"</div><div>set filepath=%~9</div><div>)</div><div><br></div><div>c:</div><div>cd C:\location of files</div><div><br></div><div>:: format ReportLog</div><div>echo. >> ReportLog.txt</div><div>echo %date% %time% Starting script NEPTJ >> ReportLog.txt</div><div><br></div><div>:: Get names of files in directory, save to FileNames.txt<br></div><div>dir /b /s *.pdf >> FileNames.txt</div><div>IF ERRORLEVEL 1 (echo %date% %time% problem with retrieving file names >> ReportLog.txt)</div><div><br></div><div>:: Count how many files are in FileNames, put into %NUMFILES%</div><div>for /f "tokens=3" %%i in ('find /v /c "SomeStringNotToBeFound" filenames.txt') do set NUMFILES=%%i</div><div><br></div><div>IF %NUMFILES% EQU 0 GOTO ZEROFILES</div><div><br></div><div>:: loop through FileNames and send</div><div>For /f "tokens=1-2* delims=" %%B IN (FileNames.txt) DO (</div><div>echo file to email is %%B >> ReportLog.txt</div><div>mailsend.exe -to %to% -from %from% %ssl% -port %port% -auth %auth% -smtp %serv% -sub "%%B" -M "%%B attached at %date% %time%" -attach "%%B" -user %from% -pass "%pass%"</div><div>)</div><div>goto WRITELOG</div><div><br></div><div>:ZEROFILES</div><div>echo %date% %time% problem with retrieving number of current files >> ReportLog.txt</div><div>mailsend.exe -to <a href="mailto:aw@yyyy.com">aw@yyyy.com</a> -from %from% %ssl% -port %port% -auth %auth% -smtp %serv% -sub "Problem with mailing" -M "Problem populating list of files to be sent" -user %from% -pass "%pass%"</div><div><br></div><div>:WRITELOG</div><div>:: format ReportLog.txt</div><div>echo %date% %time% Ending Script >> ReportLog.txt</div><div>mailsend.exe -to <a href="mailto:aw@yyyy.com">aw@yyyy.com</a> -from %from% %ssl% -port %port% -auth %auth% -smtp %serv% -sub "Download report" -M "download report" -attach "ReportLog.txt" -user %from% -pass "%pass%"</div></div><div>>></div><div><br></div><div>As with anything the "" are important.</div><div><br></div><div>I pasted this from working code, just removed a few bits.</div><div><a href="http://yyyy.com">yyyy.com</a> is not my mail server.</div><div><br></div><div>Respectfully,</div><div>Alan Wiggs</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 3:21 PM, Mauricio Tavares via TriEmbed <span dir="ltr"><<a href="mailto:triembed@triembed.org" target="_blank">triembed@triembed.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Nov 10, 2015 at 3:05 PM, Grawburg via TriEmbed<br>
<<a href="mailto:triembed@triembed.org">triembed@triembed.org</a>> wrote:<br>
> There was an article in Nuts & Volts at least a year ago about connecting a temp sensor to a Pi and e-mailing the results.<br>
> Of course, I can't find my PDF download and only have part of the Python script.  I'm going to keep looking, however.<br>
> I used the code and it worked fine.<br>
><br>
> Here's another link I had:<br>
> <a href="http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/" rel="noreferrer" target="_blank">http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/</a><br>
><br>
</span>      I've never tried that with my Pi; closest I've done was have a<br>
arduino + temp probe hung off one of the USB ports in my vmhost and a<br>
vm client would probulate it to get the temperature in python. A bit<br>
more Rube Goldbergish compared to your design though.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Brian Grawburg<br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Triangle, NC Embedded Computing mailing list<br>
> <a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br>
> <a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
> TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" target="_blank">http://TriEmbed.org</a><br>
<br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" target="_blank">http://TriEmbed.org</a><br>
</div></div></blockquote></div><br></div>