[SOLVED] Try to Send email :-)

I am at a loss then you must have changed something about the Entity Type. Or you misspelled something. It works just fine in my testing.

I create this rule

guess …

http://forum.sambapos.com/uploads/default/original/3X/f/f/ff09ea34e3490d5c185e67954bc55816a24c0f43.jpg

i have other rules with Entity DATA Customers and they working

Append a show message action to see what that tag actually returns.

I am wondering if it cant read that because hes constraining it to Delivery Entity only. I would think that wouldnt matter though if it has ticket access.

i set it in the Ticket Close Rule …
No error message
No email …

The action probably didnt fire at all cus you have it set after Close ticket.

2 Likes

Show message action is a great tool for debugging things like this.

1 Like

Eveyrhing works like a charm, it’s all Gmail’s problem …
Don’t use gmail at all …
Here are my configurations and the result.
The only problem is the {ORDERS}

In earlier pos i wrote that i use my host settings and didn’t work, after i spoke today with Tech Department the informed me that they have a “super” security system and only they can disable it !!!
So we disable it and everything is OK

neither
is working

It seems that i can’t have {ORDER} or anything close to that on email body so i decide to print ticket to a file and have it as an attachment to an email.
I want it in pdf format, I set printer to pdf but the export file is broken …
Any idea ?

In theory if you print to text file you should be able to use a script to read that test file into the message body in pretty much whatever layout goes on ticket.
Or even a script to read direct from the orders table and generate a message body.
I have a script which generates a JSON array for each order on a ticket which should be fairly straight forward to produce a line per order body with format like;
{QTY} x {ORDER} {PORTION(if not normal)} - {PRICE}
You would just need to feed TicketId into the script as part of the email action/rule

hi @JTRTech
can you share that script ?

Find function itemized(PostTicketId) in my PMS Integration topic.

It will need some adapting…
Few parts will be irrelevant.
Also note there are a couple of dependent scripts which are being loaded at the top of the script, you will also need these either as part of it or dependent like mine.

1 Like

something more simpler is a script to read the txt file and the body will be a {CALL:???.???}

Have a look at this topic.
Was based arround reading a txt file.

1 Like

My file export name is c:\tickets\{DATE:ddMMyyyy-HHmmss}.txt

with this simple script i call it in my email {CALL:read.ticket}, but the email is empty
so i supose that {DATE:ddMMyyyy-HHmmss} is not valid for script ?
even with fixed name still not working …

Handler: read

    function ticket() {
      var ticket = file.ReadFromFile('c:\\tickets\\{DATE:ddMMyyyy-HHmmss}.txt');
      return ticket ;
    }

i confirm for those who don’t own domain name/hosting that outlook.com with the following settings is working.

S M T P Server: smtp-mail.outlook.com
S M T P User: youremail
S M T P Password: yourpassword
S M T P Port: 25
To E Mail Address:
Subject:
C C Email Addresses:
From E Mail Address:
E Mail Message:
File Name:
Delete File:
Bypass Ssl Errors: False
Retry Count:
Retry Minutes:

Use {TICKET ID} for file name in print action.

Then change to;

function ticket(inputTicketId) {
      var ticket = file.ReadFromFile('c:\\tickets\\'+inputTicketId+'.txt');
      return ticket ;
    }

Then your call will be;
{CALL:read.ticket({TICKET ID})}

PS. even if {DATE:ddMMyyyy-HHmmss} did work in tickets its within quotes so would be treated as a string not a variable
file.ReadFromFile('c:\\tickets\\{DATE:ddMMyyyy-HHmmss}.txt');

Thats what the + + is about;

var ticket = file.ReadFromFile('c:\\tickets\\'+inputTicketId+'.txt');
'c:\\tickets\\'   +   inputTicketId    +     '.txt'
^^^^^^^^^^^           ^^^^^^^^^              ^^^^
 string        plus     variable      plus    sting

So is inputTicketId was 12345 it becomes;
var ticket = file.ReadFromFile('c:\\tickets\\ 12345.txt');

'c:\\tickets\\Ticket: ' + inputTicketId + '.txt'

So your filename would be 'Ticket: 12345.txt'

1 Like

For some reason Samba is searching for 0.txt
and the output file name is {TICKET ID}.txt
with ticket id i started in first place and then i set it as date format

[Exception Info 1]

Top-level Exception
Type:        System.IO.FileNotFoundException
Message:     Could not find file 'c:\tickets\0.txt'.
Source:      mscorlib
Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName, String mediaType)
   at System.Net.Mail.AttachmentBase..ctor(String fileName)
   at System.Net.Mail.Attachment..ctor(String fileName)
   at Samba.Services.Implementations.EMailService.<>c__DisplayClass3_0.<InternalSendEmail>b__2(String x)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Samba.Services.Implementations.EMailService.InternalSendEmail(String smtpUser, String smtpPassword, Int32 smtpPort, String toEmailAddress, String ccEmailAddresses, String fromEmailAddress, String subject, String body, String fileName, Boolean bypassSslErrors, MailMessage mail, SmtpClient smtpServer)
   at Samba.Services.Implementations.EMailService.SendEmail(String smtpServerAddress, String smtpUser, String smtpPassword, Int32 smtpPort, String toEmailAddress, String ccEmailAddresses, String fromEmailAddress, String subject, String body, String fileName, Boolean deleteFile, Boolean bypassSslErrors, Int32 retryCount, Int32 retryMinutes)