Comma in eMail
Moderators: JRL, Dorian (MJT support)
Comma in eMail
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?
Does anyone know of a work around for this? Do the commas need to be put in like this "," or something?
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
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.
I'm still missing something with the comma
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?
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?
Here is a sample of the comma issue
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
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
Comma Issue in eMail Fixed
Dick,
That fixed it. Thank you very much

That fixed it. Thank you very much

- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Re: Comma in eMail
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 :
So you should be able to use that in commands like SMTPSendMail and WriteLn for example without Macro Scheduler mistaking it for another parameter.
But, this works :
Code: Select all
messagemodal>This%comma%that
//or
Let>var1=Hello
Let>var2=Dave
MessageModal>%var1% %comma% %var2%