Skip to content

Commit

Permalink
Added optional argument charset <Charset> to emlfile <FileName>
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed Jan 8, 2024
1 parent 3088570 commit 0abf2ce
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 33 deletions.
6 changes: 0 additions & 6 deletions docs/Basic-Items.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,6 @@
<Marker> ::= <String>
<MatterItem> ::= <UniqueID>|<String>
<MatterState> ::= open|closed|deleted
<MessageContent> ::=
(message|textmessage|htmlmessage <String>)|
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|
(emlfile <FileName>)
<MessageID> ::= <String>
<Namespace> ::= <String>
<NotesName> ::= notes/<String>
Expand Down
5 changes: 5 additions & 0 deletions docs/GamUpdates.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g

See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation

### 6.67.08

Added optional argument `charset <Charset>` to `emlfile <FileName>` in `gam <UserTypeEntity> draft|import|insert message`;
the default value is `ascii`.

### 6.67.07

Updated `gam <UserTypeEntity> delete message` to handle this error:
Expand Down
4 changes: 2 additions & 2 deletions docs/How-to-Upgrade-from-Standard-GAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.67.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final
MacOS High Sierra 10.13.6 x86_64
Expand Down Expand Up @@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.67.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
Windows-10-10.0.17134 AMD64
Expand Down
3 changes: 1 addition & 2 deletions docs/Send-Email.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ Added the option `mailbox <EmailAddress>` to `gam sendemail` to allow specifying
(message|textmessage|htmlmessage <String>)|
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|
(emlfile <FileName>)
(gcsdoc|gcshtml <StorageBucketObjectName>)
```
```
<Time> ::=
Expand Down
15 changes: 7 additions & 8 deletions docs/Users-Gmail-Messages-Threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|
(emlfile <FileName>)
```
(emlfile <FileName> [charset <Charset>]))
## Message queries with dates
```
query <QueryGmail> [querytime<String> <Date>]*
Expand Down Expand Up @@ -211,8 +210,8 @@ You can have GAM do the substitutions for you with the `matchlabel <LabelName>`
Add a draft message to a user's mailbox.
```
gam <UserTypeEntity> draft message
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
<MessageContent>
(attach <FileName> [charset <Charset>])*
(embedimage <FileName> <String>)*
```
Expand All @@ -221,7 +220,7 @@ gam <UserTypeEntity> draft message
* `file|htmlfile <FileName> [charset <Charset>]` - Read the message from `<FileName>`
* `gdoc|ghtml <UserGoogleDoc>` - Read the message from `<UserGoogleDoc>`
* `gcsdoc|gcshtml <StorageBucketObjectName>` - Read the message from the Google Cloud Storage file `<StorageBucketObjectName>`
* `emlfile <FileName>` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message file.
* `emlfile <FileName> [charset <Charset>]` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message file. The default `chatser` is `ascii`.
The `<SMTPDateHeader> <Time>` argument requires `<Time>` values which will be converted to RFC2822 dates. If you have these headers with values that
are not in `<Time>` format, use the argument `header <SMTPDateHeader> <String>`.
Expand All @@ -244,9 +243,9 @@ Your command line will have: `embedimage file1.jpg image1` embedimage file2.jpg
Import a message into a user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP.
```
gam <UserTypeEntity> import message
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
(addlabel <LabelName>)* [labels <LabelNameList>]
<MessageContent>
(attach <FileName> [charset <Charset>])*
(embedimage <FileName> <String>)*
[deleted [<Boolean>]] [checkspam [<Boolean>]] [processforcalendar [<Boolean>]]
Expand All @@ -257,7 +256,7 @@ gam <UserTypeEntity> import message
* `file|htmlfile <FileName> [charset <Charset>]` - Read the message from `<FileName>`
* `gdoc|ghtml <UserGoogleDoc>` - Read the message from `<UserGoogleDoc>`
* `gcsdoc|gcshtml <StorageBucketObjectName>` - Read the message from the Google Cloud Storage file `<StorageBucketObjectName>`
* `emlfile <FileName>` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message.
* `emlfile <FileName> [charset <Charset>]` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message. The default `chatser` is `ascii`.
When `emlfile` is not specified:
* If `to` is not specified, it is set to the user email addresses in `<UserTypeEntity>`.
Expand Down Expand Up @@ -292,9 +291,9 @@ Your command line will have: `embedimage file1.jpg image1` embedimage file2.jpg
Insert a message into a user's mailbox similar to IMAP APPEND, bypassing most scanning and classification.
```
gam <UserTypeEntity> insert message
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
(addlabel <LabelName>)* [labels <LabelNameList>]
<MessageContent>
(attach <FileName> [charset <Charset>])*
(embedimage <FileName> <String>)*
[deleted [<Boolean>]]
Expand All @@ -305,7 +304,7 @@ gam <UserTypeEntity> insert message
* `file|htmlfile <FileName> [charset <Charset>]` - Read the message from `<FileName>`
* `gdoc|ghtml <UserGoogleDoc>` - Read the message from `<UserGoogleDoc>`
* `gcsdoc|gcshtml <StorageBucketObjectName>` - Read the message from the Google Cloud Storage file `<StorageBucketObjectName>`
* `emlfile <FileName>` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message file.
* `emlfile <FileName> [charset <Charset>]` - Read the message from the EML message file `<FileName>`. SMTP headers specified in the command will replace those in the message file. The default `chatser` is `ascii`.
When `emlfile` is not specified:
* If `to` is not specified, it is set to the user email addresses in `<UserTypeEntity>`.
Expand Down
12 changes: 6 additions & 6 deletions docs/Version-and-Help.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.67.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
Expand All @@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAMADV-XTD3 6.67.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
Expand All @@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information
```
gam version extended
GAMADV-XTD3 6.67.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
Expand Down Expand Up @@ -65,15 +65,15 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.67.07
Latest: 6.67.08
echo $?
1
```

Print the current version number without details
```
gam version simple
6.67.07
6.67.08
```
In Linux/MacOS you can do:
```
Expand All @@ -83,7 +83,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.67.07 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.67.08 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
Expand Down
22 changes: 17 additions & 5 deletions src/GamCommands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,7 @@ If an item contains spaces, it should be surrounded by ".
(message|textmessage|htmlmessage <String>)|
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|
(emlfile <FileName>)
(gcsdoc|gcshtml <StorageBucketObjectName>)
<MessageID> ::= <String>
<Namespace> ::= <String>
<NotesName> ::= notes/<String>
Expand Down Expand Up @@ -4412,6 +4411,12 @@ gam print schema|schemas [todrive <ToDriveAttribute>*]

# Send Email

<MessageContent> ::=
(message|textmessage|htmlmessage <String>)|
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|

gam sendemail [recipient|to] <RecipientEntity>
[from <EmailAddress>] [mailbox <EmailAddress>] [replyto <EmailAddress>]
[cc <RecipientEntity>] [bcc <RecipientEntity>] [singlemessage]
Expand Down Expand Up @@ -6932,22 +6937,29 @@ gam <UserTypeEntity> print labels|label [todrive <ToDriveAttribute>*]
x400-trace
<SMTPHeaderList> ::= "<SMTPDateHeader>|<SMTPHeader>(,<SMTPDateHeader>|<SMTPHeader>)*"

<MessageContent> ::=
(message|textmessage|htmlmessage <String>)|
(file|textfile|htmlfile <FileName> [charset <Charset>])|
(gdoc|ghtml <UserGoogleDoc>)|
(gcsdoc|gcshtml <StorageBucketObjectName>)|
(emlfile <FileName> [charset <Charset>])

gam <UserTypeEntity> draft message
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
(attach <FileName> [charset <CharSet>])*
(embedimage <FileName> <String>)*
gam <UserTypeEntity> import message
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
(addlabel <LabelName>)* [labels <LabelNameList>]
<MessageContent> (replace <Tag> <UserReplacement>)*
(attach <FileName> [charset <CharSet>])*
(embedimage <FileName> <String>)*
[deleted [<Boolean>]] [checkspam|nevermarkspam [<Boolean>]] [processforcalendar [<Boolean>]]
gam <UserTypeEntity> insert message
<MessageContent> (replace <Tag> <UserReplacement>)*
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
(addlabel <LabelName>)* [labels <LabelNameList>]
<MessageContent> (replace <Tag> <UserReplacement>)*
(attach <FileName> [charset <CharSet>])*
(embedimage <FileName> <String>)*
[deleted [<Boolean>]]
Expand Down
5 changes: 5 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Merged GAM-Team version

6.67.08

Added optional argument `charset <Charset>` to `emlfile <FileName>` in `gam <UserTypeEntity> draft|import|insert message`;
the default value is `ascii`.

6.67.07

Updated `gam <UserTypeEntity> delete message` to handle this error:
Expand Down
9 changes: 5 additions & 4 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66261,7 +66261,8 @@ def _appendToHeader(header, value):
emlFile = False
elif myarg == 'emlfile':
filename = getString(Cmd.OB_FILE_NAME)
msgText = readFile(filename, encoding='ascii')
encoding = getString(Cmd.OB_CHAR_SET) if checkArgumentPresent('charset') else 'ascii'
msgText = readFile(filename, encoding=encoding)
emlFile = True
internalDateSource = 'dateHeader'
elif myarg == 'replace':
Expand Down Expand Up @@ -66400,27 +66401,27 @@ def _appendToHeader(header, value):
entityActionFailedWarning([Ent.USER, user], str(e), i, count)

# gam <UserTypeEntity> draft message
# (<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
# <MessageContent> (replace <Tag> <UserReplacement>)*
# (<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
# (attach <FileName> [charset <CharSet>])*
# (embedimage <FileName> <String>)*
def draftMessage(users):
_draftImportInsertMessage(users, 'draft')

# gam <UserTypeEntity> import message
# <MessageContent> (replace <Tag> <UserReplacement>)*
# (<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
# (addlabel <LabelName>)* [labels <LabelNameList>]
# <MessageContent> (replace <Tag> <UserReplacement>)*
# (attach <FileName> [charset <CharSet>])*
# (embedimage <FileName> <String>)*
# [deleted [<Boolean>]] [nevermarkspam [<Boolean>]] [processforcalendar [<Boolean>]]
def importMessage(users):
_draftImportInsertMessage(users, 'import')

# gam <UserTypeEntity> insert message
# <MessageContent> (replace <Tag> <UserReplacement>)*
# (<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
# (addlabel <LabelName>)* [labels <LabelNameList>]
# <MessageContent> (replace <Tag> <UserReplacement>)*
# (attach <FileName> [charset <CharSet>])*
# (embedimage <FileName> <String>)*
# [deleted [<Boolean>]]
Expand Down

0 comments on commit 0abf2ce

Please sign in to comment.