Address format under Net Framework 2.0

E

Ed Bitzer

I have been successful in sending mail using System.Net.Mail with the
format strTo = ""lastname,firstname" <emailaddress>" including strings
addresses separated by commas yet I now read in the Net Framework
Development Center that the Mail Address Class requires the
MailAddress in the form of, using their example,
"(e-mail address removed)","Ben Miller). Appreciate knowing if I should change
my code when my syntax confirms with what I thought was standard email
address protocol which stated any text could precede an address
enclosed in <> brackets and if fact most commercial software will
generate this construction from a proper name field and an email
address field..

Ed
 
G

Guru

Ed Bitzer said:
I have been successful in sending mail using System.Net.Mail with the
format strTo = ""lastname,firstname" <emailaddress>" including strings
addresses separated by commas yet I now read in the Net Framework
Development Center that the Mail Address Class requires the MailAddress in
the form of, using their example, "(e-mail address removed)","Ben Miller).
Appreciate knowing if I should change my code when my syntax confirms with

Both displyname before email address and displayname after email address are
valid, so, as long as your parameters result in a format that is valid there
should be no need to change your code if you're using the
MailAddress(String, String) constructor.
what I thought was standard email address protocol

It's a format, not a protocol.
which stated any text
could precede an address

Crap. unquoted "(" (left parenthesis), ")" (right parenthesis), "<" (left
angle bracket), or ">" (right angle bracket), "," (comma), ":" (colon), "@"
(at), "!" (bang), "/" (slash), "=" (equal), and ";" (semicolon) will stuff
the addressing.

Read the standard before you try to use it to prop up your invalid
assumptions.
enclosed in <> brackets and if fact most
commercial software will generate this construction from a proper name
field and an email address field..

The crappy mail client in VS is far from standard. Just take a look at the
woeful non-compliant headers it creates. If the mail gets to its intended
destination then don't worry about it.
 
E

Ed Bitzer

Guru - you can tell I am an armature, unfortunately not young, and I
apologize for a poor choice of descriptive words. I appreciate more
than you may realize how valuable being able to ask questions here of
you professionals. I accept your advice that if it works don't fix
it, and it is working. I remain curious why I see the "construction"
so often offered of descriptive name <emailname@somedomain> in that
order.

Ed
 
C

Cor Ligthert[MVP]

Ed,

What you ask has not much to do with the VB for Net language code, more with
the way an address is created.

To get better answers than from most probably all amateurs about this in
this newsgroup, I would probably try it in your case in an Outlook
newsgroup. (Or even an aspnet newsgroup where the active people in that have
probably much more to do with this). Although you have a change that
Herfried knows this because he is often busy with Uri's and that kind of
stuff.

Cor
 
G

Guru

Ed Bitzer said:
Guru - you can tell I am an armature, unfortunately not young, and I
apologize for a poor choice of descriptive words. I appreciate more than
you may realize how valuable being able to ask questions here of you
professionals. I accept your advice that if it works don't fix it, and it
is working. I remain curious why I see the "construction" so often
offered of descriptive name <emailname@somedomain> in that order.

Why you see them so often in one format as opposed to another is because of
some unknown person's preference for one format over another. Until
microsoft released their b0rked email/news client, Outhouse Express, rude,
inconsiderate and idiotically backward top-posting was unheard of. Now,
rude, inconsiderate and idiotically backward top-posters are everywhere.

HTH
 
G

Guru

Cor Ligthert said:
Ed,

What you ask has not much to do with the VB for Net language code, more
with the way an address is created.

To get better answers than from most probably all amateurs about this in
this newsgroup, I would probably try it in your case in an Outlook
newsgroup. (Or even an aspnet newsgroup where the active people in that
have probably much more to do with this). Although you have a change that
Herfried knows this because he is often busy with Uri's and that kind of
stuff.

LMAO - you moron.
 
E

Ed Bitzer

Cor, not to drag this out but my problem is with the VB for Net
language code that specifically states that I should present the
address field first and the name second in my code where as common
practice with most software requires the name precede the address with
the latter enclosed in brackets. Of course what is happening behind
the scenes with my code and the Net Framework possibly is to reorder
the entry and add the brackets. To further complicate I, for lack of
knowledge, entered them as name <address> in to the VB code and that
worked.

I will take your advise and explore other forums (but you guys
obviously know .net languages better than any others I have
encountered). Hate to hear that there are a few things out there that
you do not understand<g>

Ed
 
F

Family Tree Mike

I don't think this is a big deal. I think that the order is logical in that
the required value for an email is the email address. The optional parameter
is the display name. When there are optional parameters, normaly, the
overrides do not switch the order of the parameters. This is why email
address is the first item, in my opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top