Creating Script from Access Report

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Creating Script from Access Report

Post by Joehome » Tue Nov 06, 2007 8:54 pm

Folks,
I am trying to create a Macro Script from an access report exported to a text file. All is working with the exception of the Let Body command. Is there a way to allow multiple lines be the body usind the Sendmail command? Or am I going about this all wrong?
Any help is appreciated.
thanks
-Joe

Code: Select all

SMTPSendMail>Recipients,192.168.1.112,JRLC,Name,Subject,Body,
Let>SENDMAIL_STATUS=1
Let>Subject=JRLC Customer Order Ack
Let>[email protected]
Let>Name=JRLC Customer Service



Let>[email protected]
Let>Body= The Following Is your Order Ack.


Let>Body=              Lines                1   3DCAR
Let>Body=              Lines                2   3DCAR

,

SMTPSendMail>Recipients,192.168.1.112,JRLC,Name,Subject,Body,


Message>Result of SendMail: %SMTP_RESULT%

-Joe

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Nov 06, 2007 9:10 pm

Use CRLF (carriage-return+line-feed):

Let>Body=Line One
Let>Body=%Body%%CRLF%Line Two
Let>Body=%Body%%CRLF%Line Three
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Post by Joehome » Tue Nov 06, 2007 9:16 pm

Wow, that was most awesome. and quick! THanks it worked like a charm. What a program. It keeps getting better and better! Thank you so much! I was beating my head against the wall for weeks!
-Joe :lol: :D :D :D
-Joe

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Nov 06, 2007 9:20 pm

I was beating my head against the wall for weeks!
Please don't do that! It's not healthy. Next time - save the headache and ask us! It is quicker and harmless :-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Sendmail using HTML

Post by Joehome » Wed Nov 07, 2007 4:54 pm

Ok, Since we opened this rabbithole.... no more banging heads...

Is there a way to use the sendmail command to send html emails instead of plain text?
thanks
-Joe
-Joe

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Nov 07, 2007 4:58 pm

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

SENDMAIL in HTML format - What to dowith the VB code

Post by Joehome » Thu Nov 08, 2007 2:07 pm

Sorry, I did see that other post but I am affraid that I dont know what to do with it. (everone be nice , now) :D

Do I add that code directly into the macro script? Also this states that I can create an HTML message from a web page. What if I don't have a web page and just want to add the HTML code from the script directly? Or do I have to generate 100 plus HTML pages, one for each message I want to send?
Currently I have a macro script that looks something like this. (see below) The tabs are my feeble attempt to format the page in an readable format, thus the need for HTML formatting. The script repeats for each email that needs to be sent. It works ok being generated from the access report (exported as a text file, .SCP) however, this is obviously without the HTML. How do I create something simmilar using the VB code keeping in mind that this script could contain hundreds of "Emails".

Alternatively, can I just use plain text messages? Are there more commands out there that I just dont know about that would allow me to format this message better instead of Tab,Tab,Tab? I only need this to be HTML to "Make it pretty".
Thanks again for all the help!

Code: Select all

Let>SENDMAIL_STATUS=1
Let>Subject=JRLC Sales Order Acknowlegment for Order ID 105268

Let>[email protected]
Let>Name=JRLC Customer Service

Let>[email protected]
Let>Body=The John Company

Let>Body= %Body%%CRLF% Specialized Materials
Let>Body=%Body%%CRLF% address line here
Let>Body=%Body%%CRLF%

Let>Body=%Body%%CRLF%%TAB%%TAB%%TAB%%TAB%SALES ORDER ACKNOWLEDGEMENT
Let>Body=%Body%%CRLF%
Let>Body=%Body%%CRLF%  %TAB% %TAB% %TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%TAB% Customer Order ID: 105268

Let>Body=%Body%%CRLF%  %TAB% %TAB%%TAB%%TAB% %TAB%%TAB%%TAB%%TAB% %TAB% Customer ID: 3HOFOU
Let>Body=%Body%%CRLF%

Let>Body=%Body%%CRLF%Sold to      %TAB%%TAB%%TAB% %TAB%%TAB%            Ship To
Let>Body=%Body%%CRLF%FOUNDATION %TAB% %TAB%%TAB%%TAB% %TAB%%TAB%FOUNDATION

Let>Body=%Body%%CRLF%4 Shady Lane %TAB% %TAB%%TAB%%TAB% %TAB%%TAB%4 Shady Lane

Let>Body=%Body%%CRLF% %TAB% %TAB%%TAB%%TAB% %TAB%%TAB%
Let>Body=%Body%%CRLF%Attn: Nam %TAB% %TAB%%TAB%%TAB% %TAB%%TAB%Attn: Nam

Let>Body=%Body%%CRLF%Town, NM   875320000 ______________________________________________Town, NM   875320000

Let>Body=%Body%%CRLF%           Lines                 1   3HOFOU
Let>Body=%Body%%CRLF%                                     DO NOT USE, USE PART #1A-O7B-025

,

SMTPSendMail>Recipients,192.168.1.55,JRLC,Name,Subject,Body,
-Joe

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

duh

Post by Joehome » Thu Nov 08, 2007 4:59 pm

Ok, I think I get it.... I will post on my progress! thanks!
-Joe
-Joe

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

almost

Post by Joehome » Thu Nov 08, 2007 7:00 pm

Well,
I did finally figure out the VBSCript part. That was cool and I did get the test message to send out in HTML, but when I tried to modify my own html it gave me a VB error 1006 Expected ')'
Line 2, Column 98. Anyone know why?

Here is the line I changed. I also tried this on multiple lines with the Let>Body=%body%%CRLF% commands in the beginning. It diddnt like that either.
Any help is appreciated.

Code: Select all

VBEND
Let>body=<html><body><table><tr><td>visit this</td><td>super</td><td>website</td></tr></table></body></html>
VBEval>SendEmail("[email protected]","[email protected]","Test html","%body%",1),res
Last edited by Joehome on Wed Dec 19, 2007 10:33 pm, edited 1 time in total.
-Joe

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Problem with Quotation Marks in HTML code

Post by Joehome » Thu Nov 08, 2007 8:46 pm

Folks,
It seems like there is an issue with useing " Quotation marks in my HTML code. Is there a way around this? If I omit the following line from the script it works fine. As soon as I try to Center the text, I get the VB error. Anyone know why?
On a positive note, I solved my "Multi Line" HTML Body issue too - Arent you all so proud of me? :D

Thanks,
-Joe

Code: Select all

Let>body=%body%<p>SALES ORDER ACKNOWLEDGEMENT</p>
-Joe

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Nov 08, 2007 8:56 pm

Quotation marks are string delimiters in VBScript. You just need to double quote them. Do this prior to the VBEval statement:

StringReplace>body,","",body
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Quote issue solved!

Post by Joehome » Thu Nov 08, 2007 9:06 pm

Nice! Thanks! WOW , this project is taking shape! Thanks to you!!!!
-Joe

Joehome
Junior Coder
Posts: 34
Joined: Tue Nov 06, 2007 8:44 pm
Location: New England

Project complete

Post by Joehome » Wed Dec 19, 2007 10:31 pm

I am happy to say that this project is up and running! Thanks to Marcus and this wonderful program. It really plays nice with Access and HTML. (once you figure out the blended version of SQL, HTML and Macro Script required!) :-)
-Joe

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts