Author |
Message |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
Email attachment with double byte character |
|
Hi,
I used the following code to send an email with an attached file. I found this code worked well if the file name is in English. But when the file name contained double byte characters (Chinese), the attached file in email was either truncated or renamed. Anyway to work around this? Thanks.
========================================================================
Dim first_file, String
...
code to determine the value of [first_file]
...
MailSendWithAttachment( "Sender@somewhere.com", "", "recipients@somewhere.com", &
"New file was received", &
"New file was received.\n\n", first_file)
=========================================================================
Felix
|
|
Wed Oct 31, 2012 11:25 pm |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
Some additional information: my code could capture the file name with double bytes well as I could see in the debugger.
|
|
Wed Oct 31, 2012 11:29 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Hi,
JAL doesn't support double-byte characters in String values and parameters. Please use similar JavaScript (Mail.sendWithAttachment function) or VBScript (MailSendWithAttachment function) for this task.
|
|
Thu Nov 01, 2012 5:54 am |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
Hi,
Thank you in advance. I tried to send an email with attachment in Javascript. But the log always returns "ERROR: An error occured while executing automation script: Line 2: Illegal character in local name" for this line of code.
Mail.sendWithAttachment("sender@where.com", "", "receiver@where.com", "Testing email", "Testing message", "C:\\SZTmp\\ok.txt");
|
|
Fri Nov 02, 2012 6:03 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
This error indicates you have entered invalid characters in the email sender or recipient address, which are not supported by Internet standards. (I guess the example you posted is not what you are actually using in your code) Please try some simple email address and see if that works.
For more details please Google for "Illegal character in local name" error.
|
|
Fri Nov 02, 2012 7:49 am |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
But this code works well in the same environment.
Mail.send("sender@where.com", "", "receiver@where.com", "Testing email", "Testing message");
|
|
Mon Nov 05, 2012 5:34 am |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
Hi,
I find something interesting in this issue. If I placed the file at the installation directory of 24x7 (C:\24x7) and the code ran without any problem as I did not put the folder name in front of the file name.
But even though I provided the full path name "C:\\24x7\\ok.txt", same error occured. So it seems the scheduler has a problem to interpret the folder name.
Another update is that even I used Javascript to send email, it still could not send a file with Chinese name.
|
|
Mon Nov 05, 2012 6:03 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
This information is indeed very interesting and helpful for troubleshooting the issue.
Can you reproduce this issue with binary file attachments such as images? I'm trying to figure out if file content or encoding make a difference.
How the email settings for Content type are currently configured in the 24x7 settings (Tools/Options menu)? text/plain or text/html?
|
|
Mon Nov 05, 2012 1:49 pm |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
I used the default setting but seems it did not affect the outcome. File attachment of images can also be sent but the processing time is much longer.
|
|
Tue Nov 06, 2012 5:11 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
If I get your response correctly, you can send image attachments located in any folder, the issue is specific only to text based attachments if they are located any folder other then the scheduler's home folder. Did I get it correctly?
|
|
Tue Nov 06, 2012 12:50 pm |
|
 |
felixc
Joined: 24 Sep 2007 Posts: 20 Country: Hong Kong |
|
|
|
I could send images, text files and even *.jar files in email attachment if I did not specify the full path name, which means they can be placed at the scheduler's home folder only.
If I specify the full path name, even the file was placed at the home folder, it could not be sent in email attachment.
|
|
Tue Nov 06, 2012 10:52 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I setup a test environment to mimic your regional settings and was able to find a workaround for this issue. Basically if you avoid using : and \ symbols you should be ok, You can use relative path and Unix style file notation to refer to any file on the disk, for example
Mail.sendWithAttachment("sender@where.com", "", "receiver@where.com", "Testing email", "Testing message", "../SZTmp/ok.txt");
Here I asusme that 24x7 is installed in c:\24x7 and ok.txt is located in C:\SZTmp
Hope this helps.
|
|
Wed Nov 07, 2012 12:08 pm |
|
 |
|