Hot Topic (More than 10 Replies) Emailing HTML - MergeFilePrint (Read 2176 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Emailing HTML - MergeFilePrint
Jan 17th, 2018 at 5:30pm
Print Post Print Post  
Hi folks!

I'm playing with an upgrade to be able to email out merge docs as HTML content rather than our current process of using merge programming, pull up the doc in MS Word, Print to PDF, and save it as an attachment.

My first step is using MergeFilePrint to create an HTML output -- and I am almost able to do so -- however, the merge content I am trying to include (DBName) is not populating.   It is creating an output file (which is great), but no file data appears.  Am I doing anything wrong, or do I need to do "DR Screen Lite!DBName" instead of "DBName"?

Code
Select All
MergeFilePrint("s:\Docs\DB\LAATEST2.HTM","HTM","","","DBName=DBName","s:\Docs\DB\200664B", 0)
 

  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #1 - Jan 17th, 2018 at 9:19pm
Print Post Print Post  
You only need to use the matches argument if you are putting in calculated or looked up values. So you don't need to do it for elements on your form. But the way your code was written you would be inserting the string value of DBName into the document, not the value of the element DBName which is what the following code would do.

Code
Select All
MergeFilePrint("s:\Docs\DB\LAATEST2.HTM","HTM","","","DBName=" + DBName,"s:\Docs\DB\200664B", 0) 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Emailing HTML - MergeFilePrint
Reply #2 - Jan 17th, 2018 at 11:43pm
Print Post Print Post  
That helps ... thanks!

So I'm slowly building up an HTML template, and when I try to add fields, I start getting the following output ...

Code
Select All
Example Text 3

class=SpellE>LTTRName]]
 



What is that class=SpellE> error and how can I eliminate that?  I'm currently building the HTML document in Word 10, and saving as HTML ...
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #3 - Jan 18th, 2018 at 2:17pm
Print Post Print Post  
Take a look at the HTM in a simple text editor such as Notepad. In order for the Sesame Merge to work the tags need to appear as [[FieldName]], my guess is you'll see something like

Quote:
[[<p class=SpellE>LTTRName]]</p>


If that is the case, just remove that <P> tag in it's entirety and it's matching </P>.

*Note* You'll want to do this after you have it looking exactly how you want, as opening it back up in Word is likely to cause Word to put the tags back in....

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Emailing HTML - MergeFilePrint
Reply #4 - Jan 18th, 2018 at 3:45pm
Print Post Print Post  
Perfect ... thanks.  I acknowledge my limitations with HTML and after I went to my customer service manager and made her cry, she will try to open it in a real HTML editor and look at it.

Next question -- while it's creating bad import data, I've moved ahead to try to send out the HTML in an email, and it's failing -- when I send an email without the attachment, it goes fine, but when I put vOutputFile in my @sendmail command, nothing is received by the recipient.  Examples on the Lantica boards suggest I'm doing this right -- am I missing something?

Here's my code thus far ...

Code
Select All
var vOutputFile as string
var n as int
var vTitle as string
var vMessage as string
var vServerdate as string = @serverdate()
var vDate as string

vDate = @Dow$(vServerdate) + ", " + @month$(vserverdate) + " " + @dom(vServerdate) + ", " + @year(vServerdate)

vOutputFile = "S:\Docs\DB\" + DBID + "-ELA-" + @num(@serverdate()) + "-" + @num(@servertime()) + ".html"

MergeFilePrint("s:\Docs\DB\LAATEST3.HTM","HTM","","",
	"LTTRName=" + DBName +
	";LTTRAdd1=" + DBAdd1 +
	";LTTRAdd2=" + DBAdd2 +
	";LTTRCity=" + DBCity +
	";LTTRDate=" + vDate +
	";LTTRClt=" + DBClt +
	";LTTRBal=$" + DBBal +
	";LTTRDBID=" + DBID,
	vOutputFile, 0)

vTitle = "TEST LAA 7"
vMessage = ""

n = @sendmail("mail.kingstondc.com",vTitle,"bwettlaufer@kingstondc.com",DBEmail,"","",vMessage,"bwettlaufer@kingstondc.com","SECRETPASSWORD",vOutputFile)
 

  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #5 - Jan 18th, 2018 at 5:06pm
Print Post Print Post  
What is the return value from Sendmail?

Code
Select All
writeln(n) 



Also it should probably be

Code
Select All
n = @sendmail("mail.kingstondc.com",vTitle,"bwettlaufer@kingstondc.com",DBEmail,"","",vMessage,"bwettlaufer@kingstondc.com","SECRETPASSWORD","",vOutputFile) 



This way the file is attached as an HTML file rather than an Binary file.

-Ray

ps. you should have mail from me. If you don't, call me.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Emailing HTML - MergeFilePrint
Reply #6 - Jan 18th, 2018 at 8:48pm
Print Post Print Post  
Hmmm ... writeln(n) returns 0.

Changing the attachment to another field, as "",vOutput1 still doesn't send the email, but I can see the output file created ... could this have to do with a server-side vs client-side interpretation where the file is, as S:\ is our mapped linux server on our Windows network, but the location would be .\Docs\DB as far as an internal server is concerned?
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #7 - Jan 18th, 2018 at 9:02pm
Print Post Print Post  
If it's 0, that means the SMTP server did not report an error with it, so it has been sent. So next thing I'd look at is the spam filter on the receiving side.

Sendmail and MergeFilePrint are both Client side programming. And a bad file path I believe returns a -6 from SendMail. I know it returns an error just can't recall the exact error code.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Re: Emailing HTML - MergeFilePrint
Reply #8 - Jan 18th, 2018 at 10:14pm
Print Post Print Post  
OK ...

n = @sendmail("mail.kingstondc.com",vTitle,"bwettlaufer@kingstondc.com","support@kin
gstondc.com","","",vMessage,"bwettlaufer@kingstondc.com","SECRETPASSWORD","")

- writeln returns 0
- email arrives

n = @sendmail("mail.kingstondc.com",vTitle,"bwettlaufer@kingstondc.com","support@kin
gstondc.com","","",vMessage,"bwettlaufer@kingstondc.com","SECRETPASSWORD","","")


- writeln returns 0
- email arrives

n = @sendmail("mail.kingstondc.com",vTitle,"bwettlaufer@kingstondc.com","support@kin
gstondc.com","","",vMessage,"bwettlaufer@kingstondc.com","SECRETPASSWORD","",vOu
tputFile)

- writeln returns -6
- no email arrives

I also tried using a non-binary attachment describing a local files on the server ".\sesame_allow.txt", "sesame_allow.txt", etc, still -6 and still no email arrives ...




  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #9 - Jan 19th, 2018 at 2:23pm
Print Post Print Post  
Sendmail is client side so the file path would need to be relative to the client. Try something like C:\Sesame2\sesame.ini

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Emailing HTML - MergeFilePrint
Reply #10 - Jan 19th, 2018 at 3:02pm
Print Post Print Post  
What you need to do upon looking closer at the code is change your one line to

Code
Select All
vOutputFile = "S:\Docs\DB\" + DBID + "-ELA-" + @num(@serverdate()) + "-" + @num(@servertime()) 



and your other line to

Code
Select All
n = @sendmail("mail.kingstondc.com", vTitle, "bwettlaufer@kingstondc.com", "support@kingstondc.com", "", "", vMessage, "bwettlaufer@kingstondc.com", "SECRETPASSWORD", "", vOutputFile + ".htm") 



The reason for this is because MergeFilePrint() automatically adds an extension to the output file.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged