[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1291
  • Last Modified:

BMail

You guys are going to start hating me soon.

I got bmail working like a dream.

Now how to I form a send event to bmail and incorporating informations from certain fields in the record.  Such as the email address. and some genaric body information along with a list of technician names and phone numbers.  Also,  I'm guessing theres no way to send a carriage return instead of haveing one long string?

This is going to be the death of me.. I should probably just buy the dang plugin.
0
Cruizectrl
Asked:
Cruizectrl
  • 25
  • 24
  • 3
1 Solution
 
lesouefCommented:
There are several ways to do this:
generate a script using bmail with filemaker and execute it using send event.
write a script using arguments to pass the info from filemaker to the script when you execute it.
if some of the info is to come from several records like yr technician list, you need to make the list using a loop to "chain" them.
if you need "returns" in yr texts strings, this is awquid / windows since filemaker uses only <cr>, no <lf>, therefore the shell script won't be ok.
in this case, you need to generate the script line by line using "echo [text] >> script.cmd" to let cmd concatenate lines using the right type of returns.
I known how to do all of this, but it is rather extensive to explain, an example would be better. which method would you like?
if is far easier to use a plug-in to generate files from filemaker than exporting; there again there is a free one which can help a lot:
it handles file generation and code replacement for <cr> to <crlf> for instance.
http://www.geocities.com/SiliconValley/Network/9327/plPLUGs.html
download "file toolbox"
can you provide an exmaple of yr database to build an example on it, or shall I do a fake one?
0
 
CruizectrlAuthor Commented:
From: Haven't decided what account.
To: Siemens PM List::Email&";"
BCC if possible: Haven't decided this one either.

Subject:
"Hegele Logistic Job" & " for " & HTL::Site Name & " in " & HTL::Site City & ", " & HTL::Site State & " on " &  HTL::Install Date & " " & "at " & HTL::Install Time

Body:
"The following technicians have been scheduled."  &¶ & ¶ & 

Technicians::First Name & " " & Technicians::Last Name & " " & "(Project Lead)" & ¶ &  Technicians::Cell   &¶ & ¶ & 
Technicians 2::First Name & " " & Technicians 2::Last Name & ¶  &
Technicians 2::Cell & ¶ & ¶ & 
Technicians 3::First Name & " " & Technicians 3::Last Name & ¶ & 
Technicians 3::Cell & ¶ & ¶ &
Technicians 4::First Name & " " & Technicians 4::Last Name & ¶ &
Technicians 4::Cell & ¶ & ¶ &
Technicians 5::First Name & " " & Technicians 5::Last Name & ¶ & 
Technicians 5::Cell

This is what I'm using for my current email.
0
 
lesouefCommented:
What I meant was to get the file to write the example in it, otherwise I need to re-create the data structure to write the script
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CruizectrlAuthor Commented:
Sure.. Where can I send it to?
0
 
lesouefCommented:
Normally you should post the file to comply EE's rules.
If you've got no site, send it by mail to me: s[at]lesouef[dot]net
I'll post the result on my site once finished for others to be able to view the solution if you don't mind.
0
 
CruizectrlAuthor Commented:
I sent it over but I sent one that has passwords set.. Let me activate the guest on anotherone and resend.
0
 
lesouefCommented:
I did not receive anything. My account has a size limit for attachments: 5MB once encoded.
Waiting for the file, will be done too-morrow anyway, I am living on GMT+2 so close to my bed!
0
 
billmercerCommented:
Cruizectrl, yoiu can upload the file here, and post the link in this thread.
   http://www.milleniumhandandshrimp.com/upload.html

>Also,  I'm guessing theres no way to send a carriage return instead of haveing one long string?
Yes, this can be done, but to do this with bmail, you need to put the text into a plain text file, and then tell bmail to use that file instead of the command line as the source of the message, using the -m option.

As lesouef mentioned, there are plugins for this, but it's not that bad to do with a plain old export, just a few extra script steps. You just assemble the message body text in a global field, then export that field to a pre-set filename. Then bmail calls that same filename to send the message.

>This is going to be the death of me.. I should probably just buy the dang plugin.
I did say it would be more work this way... I'm such a cheapskate I don't buy plugins, that's why I know about all this free software. ;)



0
 
lesouefCommented:
be patient, the script is on its way! half done... but I have to go out tonight! (yes it's dark already)
0
 
CruizectrlAuthor Commented:
Have a few for me!
0
 
lesouefCommented:
no, that was theater tonight, we have a humour festival in town the whole week... OK, I admit there is a bar at the theater, and they don't serve any water, not my fault...
I'll finish the script too-morrow
0
 
lesouefCommented:
http://www.lesouef.net/files/Hegele.zip
this file has my script. I've done something with no plug-in though the body file generation would be a lot simpler with the plug-in to patch returns.
Because it is not as simple as Bill said, the major problem to generate an ascii file from a field on a PC is that line returns generated by the pi character in filemaker text fields are not <cr><lf>; so I use a temp table (called script) to export the body lines as an ascii file, compatible with windows.
The script itself is generated using echo, but could have been done the same way; it is just to show you both ways.
Note that the body file could be done using echos as well, but it is very slow, you need to pause in between each line, otherwise, there are file access pbs since filemaker does not wait upon send event completion before going ahead with its script.
I had to modify yr file, there is a mess with technicians:
the links between assignd techs and technicians are wrong, you use the fullname on one side, or firstname initial + surname, and lastname only on the other side. I have created a temp fullname field in technicians and changed the link to get it work for the first record in HTL. You should fix that and the best would be to link on technicians ID, not on names, you'll get 2 John Smith some day.
0
 
CruizectrlAuthor Commented:
Thanks so much!  Cant wait to try it out!
0
 
lesouefCommented:
please do, and don't be surprised if I don't answer tonight, I go out again!
0
 
CruizectrlAuthor Commented:
In the file it shows the table to be missing with the technicians.  I know I was playing around with that before I sent the file to you.. Is this what you were talking about?

When I'm looking up, I use a calculation to create a field with <Lastname>, <Firstname>

I know I was having problems with the tabels but I wasn't sure if I sent you the fixed version or not.
0
 
lesouefCommented:
In the file it shows the table to be missing with the technicians.  I know I was playing around with that before I sent the file to you.. Is this what you were talking about?
-----------
probably because the file shows <missing table> in quite a few layouts

When I'm looking up, I use a calculation to create a field with <Lastname>, <Firstname>
----------
in which table? technicians? there is none in my file... what field name is that?

I know I was having problems with the tabels but I wasn't sure if I sent you the fixed version or not.
-------------
obviously a file finished during a phone call or late at night!
0
 
CruizectrlAuthor Commented:
Hahahaha...  The script is amazing!  I'm still trying to work with it but I'm sure I'll get it.  Please stand by.
0
 
lesouefCommented:
yes, quite a good exercise!
0
 
CruizectrlAuthor Commented:
Alright.. somethings goofy still.. I'm able to send BMAIL out just fine manually but through the script, not so much.  I see both CMD windows pop and go, but I cant see the outcome of bmail.. is there a way I can break at the end to read over whats being imputed?
0
 
lesouefCommented:
yes, files are created in the same folder as the filemaker database.
the script is called send_mail.cmd and the body file is mail_body.txt.
check them or post them here for me to compare with what I got here
0
 
CruizectrlAuthor Commented:
mail_body.txt is being created just fine.

My problem is somewhere in the command.

All variable are set right in the script "server, to: and from:"

This is what I have so far in the cmd script:
"cmd.exe /c echo C:\test\bmail.exe -s " & $smtp & " -f " & $from & " -t " & $to & " -a \"Hegele Logistic Job for " & HTL::Site Name & " in " & HTL::Site City & " " &  HTL::Site State & " on " &  HTL::Install Date & " " & "at " & HTL::Install Time & "\" -m " & $param_file & " -h >> "   & $script_name

Did I mess something up?
0
 
lesouefCommented:
well, this is not the script, but the send event definition to create it.
But the pb is not there; I've been able to repeat it.
timing pb again: when the script is trying to execute the send_mail.cmd, it is still not released by the previous command, remember send event does not wait untill action completion, so:
- either you insert a 1s pause before executing send_mail.cmd or
- you move all the lines to generate send_mail before mail_body generation to get a delay in between send_mail generation and execution.
But, on a very slow PC, you may still have pbs.
To fix it in any case, send_mail should be generated the same as mail_body.txt, ie using an export routine.
Let me know if you'd like me to do this (too-morrow now as I leave in 5mn).
0
 
CruizectrlAuthor Commented:
I'm going to restore the file I got and start from the beginging.  I just wish there was a way I could pause the command being outputed to bmail so I can see if the parameters correct.
0
 
lesouefCommented:
simply pause the script before executing send_mail.cmd
0
 
CruizectrlAuthor Commented:
Doesn't look lie send_mail.cmd is being created.  But the script runs through with no errors.. I've even tried with pauses.. I'm totally confused.
0
 
lesouefCommented:
there maybe problems I did not come across like spaces in the path, etc... this has been tested only on my PC.
if send_mail is not created, it means the send event is not correct and crashes cmd.exe.
this may happen if some characters appear in the line after fields replacement, stuff like / , -
when I tested with yr database, many fields were empty, I probably did not come across the same problems.
does it work with the file I did if you use it 'as is'?
otherwisen don't worry, generating send_mail.exe like mail_body.txt will work around all these problems, but this is too-morrow!
0
 
CruizectrlAuthor Commented:
I send you a fixed version.
0
 
lesouefCommented:
I haven't received anything, but here is another version where the same method is used to generate both the script and body files.
this is still based on yr file where technicians links were wrong, so it works correctly, as far as the body is concerned, on records where the technician is correctly labelled, ie Firstname & " " & Lastname. I have modified the technicians popup list accordingly.
now, this does not have any timing problems.
http://www.lesouef.net/files/Hegele.zip
0
 
CruizectrlAuthor Commented:
Alright.. The script is generating emails now.

Now the next small thing thats going on is the information that the mail body holds isn't getting inserted into the message.  Its just showing the path..  
Bmail says I need to prefix it with CR/LF.  Tried putting that in the mail_body.txt, no go.

Almost there.
0
 
lesouefCommented:
It depends on records. records for which the technician link is wrong won't work, you won't related records info. Can you display this missing info in the overview layout? for a given record?
Try 1st record or give me an email address I can use to send you the kind of mail I can generate from here for you to compare with yr file.
0
 
CruizectrlAuthor Commented:
This is what I generate.

mail_body.txt:

The following technicians have been scheduled.

Zoltan V****(Project Lead)
***-***-****

Larry S*****

send_mail.cmd
@echo off
C:\tools\bmail.exe -s DC01 -f apech@hegelelogistic.com -t apech@hegelelogistic.com -a "Hegele Logistic Job for Texas Diagnostic Imaging in Amarillo TX on 2/13/2006 at 8:00 AM" -m C:\Documents and Settings\AndrewPech\Desktop\Email Test\mail_body.txt -h

use the email in the script .cmd file to show me what you generate.
0
 
lesouefCommented:
for mail_body, that's correct.
if other fields are not coming up, it because the links are wong or related fields are empty.

for send_mail, there is a pb with the -m argument: you placed the file in a folder which has spaces in the path, therefore bmail does not read it.
place the filemaker file in a folder like c:\test\ as a test, it should work.
In between, I'll modifiy to take space into account, ie place quotes around the path.
0
 
CruizectrlAuthor Commented:
I put the quotes in there for you!  Whoo hoo!

Is there a way I can move this script from one file to another?

Thank you thank you thank you so much.. Now I just have to figure out how to get a calendar event or appointment request send from FMPro to Outlook!

I upped this a while ago..  Heres your points
0
 
lesouefCommented:
I made the mod in my file, reload it again and you'll get the modification.
http://www.lesouef.net/files/Hegele.zip
Yes you can import my script in yr file (scriptmaker/import).

And about yr appointement triggered by fmpro, there is a recent thread about this, was it yours?
0
 
lesouefCommented:
0
 
CruizectrlAuthor Commented:
Yes.. I think so.  I haven't gotten that far.. I've been stuck on the email thing for a while.

Ick, I forgot one thing, is there a BBC option for BMAIL?  If not, I just send the mail twice.  I just need to get a copy of the message for confirmation.
0
 
CruizectrlAuthor Commented:
I meant BCC =)
0
 
lesouefCommented:
no bcc, but maybe you could use 2 addresses for "to"
try with 2 adresses seperated by ;
if it works, it's a way to get a copy too which can be implemented in the fm script.
making it blind cc for you is not a great secret either.
and in the worst case, you can send 2 mails or create a simple log file?
0
 
CruizectrlAuthor Commented:
A log file to catch and report errors might be too much work.. I can duplicate the script to send out to another address or send it to two people.
0
 
billmercerCommented:
BMail doesn't have that, but Blat does. If you want to do more sophisticated stuff, you may want to look at Blat.
http://www.blat.net 

It's another command line mailer, but it has a lot more options than Bmail does, which makes it more powerful, but a bit more complicated as well. One big advantage of Blat is that it can do authenticated SMTP, which is becoming more popular as a way of fighting spam.

BTW, it's also free.

0
 
CruizectrlAuthor Commented:
D#$mit Bill!  I just got BMail working!! hahahahahahahahaha.

But thanks.  I'll take a look at that
0
 
billmercerCommented:
It wouldn't be that hard to change, just have to change bmail to blat, and change the command line parameters slightly.
0
 
lesouefCommented:
so I guess you gonna ask me this as the next step?!
ok, but on monday then, unless it rains the whole week-end...!
0
 
CruizectrlAuthor Commented:
I'll take a shot at it..  If I need help, I'll come back.
0
 
CruizectrlAuthor Commented:
No Go.  I sent it over again lesouef =(
0
 
lesouefCommented:
What "no go"? with blat you mean?
0
 
CruizectrlAuthor Commented:
I cant figure it out.. I'm missing something that you put in to fix the missing table because the tecnicians dont get set to a line..  I've done a little bit more work on it, and I can get it running start to finish but I cant get the tech names.

I think it something simple.  After that, I'm sure I can get Blat working no problem."
0
 
lesouefCommented:
It's all about the way HTL and technicians are related. In HTL, technicians names are nto all entered the same way:
some are J. Williams, some others are John Williams, so this has to be modified unless there is a field in technicians which contains the same information to get the link correct for all records.
what I have done in mine was to create a fullname field, done from 1stname + surname, and used that to link it to HTL. Since technicians in HTL are not all entered this way, it works only for people mentionned in technicians with their first name in extendos.
do you want me to correct yr file?
0
 
CruizectrlAuthor Commented:
Nope.. I got it.

Lets see what other problems I run into. =)
0
 
lesouefCommented:
I rely on you for this!
I am on my way out soon, you've got plenty of time to look at the other problems.
0
 
CruizectrlAuthor Commented:
Woo hoo!

Got it all working just great.  Blat was definatly a good choice Bill.  Thanks for that!

Took just a little bit to get the syntax switched over in you macro lesouef.  But it all seems to be running smoothly with no relay problems thanks to the SMTP Auth in Blat.  We'll let this run for a little bit.  I thank you again gentlemen!  You are truely the masters of your craft.
0
 
lesouefCommented:
masters? that was 2 years ago! now guru & wizard! just kidding but our titles is the only glory we work for!
btw, the smtpit plug-in also has a auth function if you change yr mind in the future. the plug-in still has an advantage in many situations, cross platform dev, formatted text to html conversion for instance. but if you're happy with blat, I am happy. I had a look at it, it has almost too many arguments! but probably a good tool for automated email sending.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 25
  • 24
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now