I'm trying to automate a bulk mail-merge email procedure using email_send(). The code below works simply great. But the message part of the emails are wrapping weirdly on the receiving end. See, I've used chr(10) [LF] to force a new line. I'm thinking this places the cursor in the same column but on the next line, but since I can't see this cursor(!), I have to assume. I wanted to use chr(13) [CR] to force that new line and to put the cursor at column one, but this caused the parsing to hang the computer for infinity. Is there a special syntax I need to use to format the output the way I want it? Btw, this code is being used as part of our nightly update, so I'm trying to stay away from using forms and other screen-needed things.
Thanks for anyone's help!
--Burt
***************
Thanks for anyone's help!
--Burt
***************
Code:
dim tbl as p dim end as c tbl = table.open("teachers") query.filter = "Last_Date=date().and.isnotblank(\"email\")" query.order = "" query.options = "" query.description = "Saved Query:Today's invoicings" tbl.query_create() tbl.fetch_last() last=tbl.recno() tbl.fetch_first() A: 'Send email param_to = tbl.Email param_subject = "Music Transaction Report" param_cc = "" param_bcc = "" param_attachments = "" 'Template message may have mail merge commands. a5_mailmerge() evaluates the mail merge commands. salute=alltrim("Dear "+w_upper(lower(alltrim(tbl.sname_f)))+",") dd=chr(10)+chr(10) d=chr(10) message = alltrim("We have posted a transaction to your account. This most probably was for music we shipped to you today. But perhaps a return was credited or an adjustment made. Please visit your on-line Menu at our web site for details."+chr(10)+"http://www.burtnco.com/foyer.a5w?acct="+lower(alltrim(tbl.Link_name))+chr(10)+chr(10)+"If you have comments or questions, please write or phone me."+chr(10)+chr(10)+"Thanks as always for allowing us help fulfill your print music needs."+chr(10)+chr(10)+"Best regards,"+chr(10)+chr(10)+"--Burt"+chr(10)+chr(10)+"----------------------------"+chr(10)+"Burt & Company Discount Music Supply"+chr(10)+"PO Box 1145, Marlton NJ 08053 USA"+chr(10)+"US & Canada: Phone 800-548-2878 o Fax 888-830-2525"+chr(10)+"World: Phone 856-983-6004 | Fax 856-983-6157"+chr(10)+"[email protected] | http://www.burtnco.com") send_result = email_send(alltrim(tbl.Email),"Music Transaction Report",salute+dd+message,"","","",.f.,"","","",.f.,.t.) 'if send_result <> 1 then ' ui_msg_box("Error","E-mail message was not sent.",UI_STOP_SYMBOL) 'end if tbl.fetch_next() if end="end" goto Z end if if tbl.recno()=last end="end" end if goto A Z: tbl.close() ui_msg_box("Operation finished","E-mail messages sent.",UI_STOP_SYMBOL)
Comment