Viewing 10 reply threads
  • Author
    Posts
    • #383 Score: 0
      ican2
      Participant

      I’m using this to email POS reports that are ran after the end of day. The POS reports have the same name with the exception of the date they are for at the end.
      I attached a file but is there any way where I can just set a directory and it will pull the files from there and I’ll create a script to erase all old reports

    • #385 Score: 0
      tbare
      Keymaster
      1 pt

      Not at this point, unfortunately. Your best bet right now would be to run it from a batch file, and add the date string to the end of the filename in the format needed and pass that as part of the command line string.

      If you let me know what the date format is, I can see if I can give you a hand getting that set in a batch file if you’d like.

    • #387 Score: 0
      ican2
      Participant

      Custom Daily SYS Detail for 08-06-2017.pdf

      The only thing that changes every night is the date at the end of the file name

    • #390 Score: 0
      tbare
      Keymaster
      1 pt

      Are you familiar with batch files?

      if you put the following in a bat file, it should display today’s date:

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      echo %CURRENT_DATE%

      So, assuming most of your info is in an XML, you’d call it like this:

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      c:\path\to\swithmail.exe /s /x "c:\path\to\settings.xml" /a "c:\path\to\Custom Daily SYS Detail for %CURRENT_DATE%.pdf"

      Let me know if that gets ya set, or if you have other questions.

      Thanks!

    • #392 Score: 0
      ican2
      Participant

      I’ll modify and will try it out . I’ll add this to the script now thank you

    • #395 Score: 0
      ican2
      Participant

      I have this as the generated XML change a few thins so it doesnt show my passwords.

      <?xml version=”1.0″ encoding=”utf-8″ standalone=”yes”?>
      <SwithMailSettings>
      <ServerSettings>
      <FromName>POS </FromName>
      <FromAddress>POS@DOMAIN</FromAddress>
      <Username>USERNAME</Username>
      <Password>PASSWORD</Password>
      <ObscurePassword>False</ObscurePassword>
      <MailServer>smtp.socketlabs.com</MailServer>
      <MailServerPort>25</MailServerPort>
      <SSL>False</SSL>
      <Encoding />
      <RequestReceipt>False</RequestReceipt>
      <MessageID>False</MessageID>
      </ServerSettings>
      <EmailAddresses>
      <To>EMAIL</To>
      <CC>EMAIL</CC>
      <BCC />
      <ReplyTo />
      </EmailAddresses>
      <Attachments>
      <AttachmentPath>D:\Report_Outbox\Daily SYS Sales Detail for 08-06-2018.pdf</AttachmentPath>
      </Attachments>
      <EmailContent>
      <HTML>False</HTML>
      <DontReplaceNewLine>False</DontReplaceNewLine>
      <Subject>Micros OB Daily Sales</Subject>
      <Body>POS Daily Report</Body>
      <BodyTxtFile />
      <Priority>high</Priority>
      </EmailContent>
      </SwithMailSettings>

      Where would I add this

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      D:\SMTP Send Email\SwithMailv2210\swithmail.exe /s /x “D:\SMTP Send Email\SwithMailv2210\SwithMailSettings.xml” /a “D:\Report_Outbox\Custom Daily SYS Detail for %CURRENT_DATE%.pdf”

      This would be in the XML file generated that I would then add to the scrip to send out right. Appreciate the help big time

    • #398 Score: 0
      tbare
      Keymaster
      1 pt

      Go head and remove <AttachmentPath>D:\Report_Outbox\Daily SYS Sales Detail for 08-06-2018.pdf</AttachmentPath> from the XML File – we’re going to specify that in the command line string with the correct date.

      So you’d create a batch file (maybe called D:\SMTP Send Email\SendReport.bat) – then edit SendReport.bat and add:

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      D:\SMTP Send Email\SwithMailv2210\swithmail.exe /s /x "D:\SMTP Send Email\SwithMailv2210\SwithMailSettings.xml" /a "D:\Report_Outbox\Custom Daily SYS Detail for %CURRENT_DATE%.pdf"

      save – then double-click SendReport.bat and it should send the email with the correct attachment.

      • This reply was modified 1 year, 7 months ago by tbare.
    • #401 Score: 0
      ican2
      Participant

      Gotta be missing something . If I create copy the CLI commands and test from the GUI it goes through as a test.
      When I update the bat file though and try to run it this is what i get

      Current batch file has the following on it

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      SwithMail.exe /s /x “D:\SMTP Send Email\SwithMailv2210\SwithMailSettings.xml” /a “D:\Report_Outbox\Custom Daily SYS Detail for %CURRENT_DATE%.pdf”

      It does search for the new file date name based on the string but no matter what I do it comes up with this error when I try to run the file from CMD

      Microsoft Windows [Version 6.1.7601]
      Copyright (c) 2009 Microsoft Corporation. All rights reserved.
      C:\Users\masteraccount>”D:\SMTP Send Email\SwithMailv2210\Daily Sales.bat”
      C:\Users\masteraccount>set CURRENT_DATE=08-07-2018
      C:\Users\masteraccount>SwithMail.exe /s /x “D:\SMTP Send Email\SwithMailv2210\Sw
      ithMailSettings.xml” /a “D:\Report_Outbox\Custom Daily SYS Detail for 08-07-2018
      .pdf”
      ‘SwithMail.exe’ is not recognized as an internal or external command,
      operable program or batch file.

    • #404 Score: 0
      tbare
      Keymaster
      1 pt

      you’ll want to add the full path to SwithMail.exe in the batch file.

    • #406 Score: 0
      ican2
      Participant

      Current batch file looks like this. If I remove the lines in bold the emails goes through no attachment though as I havent set the file. Once I add them though nothing happens

      set CURRENT_DATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
      SwithMail.exe /s /x “D:\Switchmail\SwithMailSettings.xml” /a “D:\Report_Outbox\Custom Daily SYS Detail for %CURRENT_DATE%.pdf

    • #409 Score: 0
      tbare
      Keymaster
      1 pt

      Looks like you’re missing a quote at th end of the /a “d:\……pdf

      Also, use the full path the swithmail before swithmail.exe – you’ll save a lot of headaches using full paths.

Viewing 10 reply threads
  • You must be logged in to reply to this topic.