Comma in eMail

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Comma in eMail

Post by kpassaur » Wed Apr 19, 2006 8:41 am

Is there any way a comma can be used in the body of an eMail? I am sending one with an attachment and when it comes to the comma it cuts off the rest of the message and disregards the attachment (naturally as the text after the comma is not a file)

Does anyone know of a work around for this? Do the commas need to be put in like this "," or something?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Apr 19, 2006 12:10 pm

You could predefine the comma then use the variable in your subject line.

Let>comma=,
....Item1%comma% Item2%comma% Item3 and Item4....

Or you could do like I always do and predefine the subject line:


Let>server=mail.kp-net.net
Let>from=[email protected]
Let>name=Sample
Let>subject=There are commas in this message
Let>bod=Good Morning Mr. Phelps,%CRLF% Your mission, should you choose to accept it, is to read this document...
Let>attach=C:\something.doc
Let>recip=[email protected]
SMTPSendMail>recip,server,from,name,subject,bod,attach


Hope this helps,
Dick

edit....Phelps not Smith
Last edited by JRL on Wed Apr 19, 2006 2:12 pm, edited 1 time in total.

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

I'm still missing something with the comma

Post by kpassaur » Wed Apr 19, 2006 1:39 pm

I tried to use the StringReplace function to change the comma to %comma% and it didn't work. So I tried VBScript as seen below

VBStart
VBEnd

VBEval>Replace("%emallbody%",",","%comma%"),emallbody
MDL>%emallbody%
Let>comma=,
MDL>%emallbody%

This although it replaces the comma's in the emallbody variable as seen in the first message box with %comma%, when I add the Let>comma=, line and display it back they are back in as expected. So far so good; however, when I put it in the email it cuts it off again. I must be missing something.

Any ideas?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Apr 19, 2006 2:11 pm

Now I'm confused too. :?

I'm making the assumption that you're using Macro Scheduler's SMTPSendMail> command to send an email. If so, sounds to me like you're trying to make this more difficult than it is.

Could you post a sample of what you're trying to accomplish?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Here is a sample of the comma issue

Post by kpassaur » Wed Apr 19, 2006 3:15 pm

The entire script is 1500 lines but this is a sample of what I am speaking of.




ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,fromadd,frad
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,Fromname,fname
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,MailServer,MS
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,SMTPPASS,Pass
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,smtpuid,Uid
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,Authrequired,autreq
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,Showstatus,sendstat
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,MailType,MT
ReadIniFile>c:\FaxRouter\emailnotice.ini,BulkSettings,Hyperlink,SL


Dialog>Dialog1
Caption=Dialog1
Width=445
Height=250
Top=135
Left=29
Label=Message Body,184,72,true
Label=Subject Line,192,24,true
Memo=msMemo1,48,88,337,89,
Button=Continue,136,184,75,25,1
Edit=msEdit1,48,40,337,
Button=Exit,216,184,75,25,2
EndDialog>Dialog1


Label>Mainloop
Show>Dialog1,r
If>r=1,Sendemail
If>r=2,EOF
Goto>Mainloop

Label>Sendemail
Let>emallbody=%Dialog1.msMemo1%
Let>Subjectln=%Dialog1.msEdit1%
Let>attachedfile=c:\temp\test3.pdf
Let>addresspart2=[email protected]



If>%sendstat%=True
Let>sendstat=1
else
Let>sendstat=0
Endif
If>%autreq%=True,rbSecure,rbnotSecure
Label>rbSecure
Let>SMTP_AUTH=1
Let>SMTP_USERID=%Uid%
Let>SMTP_PASSWORD=%Pass%
Label>rbnotSecure
Let>SENDMAIL_STATUS=%sendstat%

///////////////////////////replace Comma with nothing
/VBStart
/VBEnd
/VBEval>Replace("%emallbody%",",",""),emallbody
////////////////////////////replace Comma with %comma%
VBStart
VBEnd
VBEval>Replace("%emallbody%",",","%comma%"),emallbody
MDL>%emallbody%
Let>comma=,
MDL>%emallbody%




SMTPSendMail>%addresspart2%,%MS%,%frad%,%fname%,%Subjectln%,%emallbody%,%attachedfile%

Label>EOF



I am allowing a user to input text into a Dialog and use it as the body of text for an email. However, with a comma the text stops and the attachment is not attached. My only solution appears to just remove commas - unless there is another way

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Apr 19, 2006 3:54 pm

Your code failed for me also. Then I took the "%"s off of "emallbody" and it worked. You may have to set VAREXPLICIT=0 just before your SMTPSendMail> line depending on if you've set it previously to 1.

Hope this helps,
Dick

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Comma Issue in eMail Fixed

Post by kpassaur » Wed Apr 19, 2006 4:28 pm

Dick,

That fixed it. Thank you very much


:D

User avatar
uniadv
Junior Coder
Posts: 29
Joined: Tue Aug 04, 2020 2:16 am

Re:

Post by uniadv » Thu Aug 13, 2020 1:55 pm

JRL wrote:
Wed Apr 19, 2006 12:10 pm
You could predefine the comma then use the variable in your subject line.

Let>comma=,
....Item1%comma% Item2%comma% Item3 and Item4....

Thanks JRL, Just found what i was searching for. :D :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Comma in eMail

Post by Dorian (MJT support) » Thu Aug 13, 2020 2:22 pm

I'm not sure sure you even have to predefine the comma anymore, as %comma% is a system variable. I don't think it always was, and I can't find in the version history when it was added. but 2006 was a long time ago.

But, this works :

Code: Select all

messagemodal>This%comma%that

//or

Let>var1=Hello
Let>var2=Dave

MessageModal>%var1% %comma% %var2%
So you should be able to use that in commands like SMTPSendMail and WriteLn for example without Macro Scheduler mistaking it for another parameter.
Yes, we have a Custom Scripting Service. Message me or go here

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