Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How Can One Enter an Email Address Containing a Comma

Jun
552
4
I have been trying to use the command "option //MailAddress=..." to enter an address such a "Jay Sage, TCMD User <jay@domain>" and then use the "sendmail" command to send a message using that address. If I enter such an address into the option dialog, it works, but it doesn't work using the command line version. The comma gets interpreted as a separator between addresses. I tried using escape characters, such as ^c for comma, ^< and ^> for the characters around the address. I tried putting double quotes around the strings. So far I have not succeeded.

Here is a sample command (with domain names altered):

TCC(27.01.24): C:\>option //MailAddress=Jay Sage, TCMD ^<[email protected]^> & option MailAddress & *sendmail [email protected] "Test Msg" test
MailAddress=Jay Sage, TCMD <[email protected]>

The MailAddress seems to be getting set as desired. However, when the message arrives in my mailbox, the FROM field contains three (!!) addresses separated by commas: "[email protected], [email protected], TCMD <[email protected]>"

Any ideas?
 
When I try that, I get the following error message from the sendmail command:

TCC: SMTP protocol error. 501 5.1.7 Bad sender address syntax.

I believe that I had already tried that approach. I am using version 27. Perhaps something changed in version 28 or 29.
 
I receive a "TCC: SMTP protocol error. 550 5.1.0 <[email protected]^> invalid address '[email protected]^'."

Here (v29.00.16) it was enough to remove the escaping (which seems not necessary because the text is within quotes), means:

Code:
option //MailAddress="Jay Sage, TCMD <[email protected]>" & echo %@option[MailAddress] & *sendmail [email protected] "Test Msg" test

Also the asterisk before sendmail command seems not necessary, means the following should be enough:

Code:
option //MailAddress="Jay Sage, TCMD <[email protected]>" & echo %@option[MailAddress] & sendmail [email protected] "Test Msg" test
 
Last edited:
When I try that, I get the following error message from the sendmail command:

TCC: SMTP protocol error. 501 5.1.7 Bad sender address syntax.

I believe that I had already tried that approach. I am using version 27. Perhaps something changed in version 28 or 29.
Have you ever been able to use a comma in this manner? I'm thinking that it might not be possible.

Have you considered maybe doing this instead:

Jay Sage - TCMD User
 
If I enter

Code:
"Jay Sage, TCMD User" <jay@domain>

for the "Address:" in the OPTION command's pop-up "Internet" panel, things work fine. However, I cannot figure out how to get

Code:
option //mailaddress=...

to work. Even if I enter the string with backquotes around it, the part with the email address is not retained, only the "friendly name" (I didn't know this term).

Code:
TCC(27.01.24): C:\>option //mailaddress=`"Jay Sage, TCMD User" <jay@domain>` & option mailaddress
mailaddress="Jay Sage, TCMD User"

With no commas, I can do the following:

Code:
TCC(27.01.24): C:\>option //mailaddress="Jay Sage <jay@domain>" & option mailaddress
mailaddress="Jay Sage <jay@domain>"

The problem is, how can I enter the address with the quotes around the friendly name with a comma and the address surrounded by redirection characters. I thought that I could escape the redirection characters, but that doesn't work either.

Code:
TCC(27.01.24): C:\>option //mailaddress="Jay Sage, TCMD User" ^<jay@domain^> & option mailaddress
mailaddress="Jay Sage, TCMD User"

Then I thought that perhaps I could enclose the whole string in actual quotes and get the ones around the name by using the escape characters ^q. That doesn't work either. The escape characters are taken literally.

Code:
TCC(27.01.24): C:\>option //mailaddress="^qJay Sage, TCMD User^q <jay@domain>" & option mailaddress
mailaddress="^qJay Sage, TCMD User^q <jay@domain>"

Then I thought maybe I could use single-quote characters around the friendly name.

Code:
TCC(27.01.24): C:\>option //mailaddress="'Jay Sage, TCMD User' <jay@domain>" & option mailaddress
mailaddress="'Jay Sage, TCMD User' <jay@domain>"

That looked promising. The SENDMAIL command sent a message, but the address in the FROM field was a mess (my real domain name was used but is edited below, and TigerTech provides my hosting service).

Code:
"'Jay Sage, TCMD User' <jay@domain>"@tigertech.net

P. S. For Alpengreis, I put the asterisk in front of the SENDMAIL command because I have an alias of that name, and here I wanted to use the actual TCC command. For Dick Johnson, of course I can use other strings with no commas, and that's what I've been forced to do so far. I just decided to try to figure out what is causing the problem with commas and how I can get the string I want.
 
As I was falling asleep last night, I suddenly thought, "SETDOS!!" Why didn't I try turning off redirection using SETDOS. Well, this morning I did, and it didn't help. It seems that the OPTION //MAILADDRESS= command reads only what is enclosed in quotation marks. If the argument is

"Jay Sage, TCMD User" <address>

the address part is ignored. OPTION MAILADDRESS returns only the name in quotes.

Code:
TCC(27.01.24): C:\>setdos /x-6 & option //mailaddress="Jay Sage, TCMD User" <address> & option mailaddress
mailaddress="Jay Sage, TCMD User"

Using ^q instead of quotes works the same. If one uses the OPTION command in interactive mode, one has no trouble entering the full string, and mail goes out with the proper FROM address.

So this looks to me like a defect in the OPTION command-line function.
 
Hmm. I just decided to see what would happen to any text entered before the quoted string. To my surprise, if there is leading, unquoted text, it is accepted along with the entire command tail, including the email address in brackets!

Code:
TCC(27.01.24): C:\>setdos /x-6 & option //mailaddress=test "Jay Sage, TCMD User" <address> & option mailaddress
mailaddress=test "Jay Sage, TCMD User" <address>

What's even more surprising is that the address works as desired (when instead of putting "test" I put just a period). With "test", that string is merged with the other string to make the following FROM address:

Code:
test Jay Sage, TCMD User <jay@domain>

With just a dot, the dot is ignored:

Code:
.Jay Sage, TCMD User <jay@domain>
 
Correction. The dot is not ignored. I just couldn't see it in the email message. I do see it in the quoted material in my previous posting.

If instead of a period, I use %@char[24] before the quoted string, the message does seem to go out with my desired FROM address, at least when I receive the message in Thunderbird. So I don't know if that non-visible character is present but not seen or ignored.

Oh, I just looked at the source code of the received message, and that character is there.

My conclusion from all this is that when OPTION //MAILADRESS= has a string that starts with a quote character, it stops reading the argument when it sees the closing quote, but when the string begins with something else, it ignores the quote characters.
 

Similar threads

Back
Top