non useful log about wrong e-mail address format

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
11/28/2009 3:02:48 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Somehow it lost another post I just did where I was saying that StreamWriter constructor has Encoding parameter. You can tell it to use any encoding (as long as appropriate codepages are installed on the system if the encoding isn't supported out of the box by .NET)

So you encode the text (from Unicode that mojoPortal uses internally I assume) to any encoding the user asked for and then you tell .NET to use TransferEncoding of base64 (to format the data for SMTP transfer since SMTP supports 7-bit, 1000 chars per line internally or something). Could use QuotedPrintable for single byte ones like ISO-8859-7 (not 7-bit that would probably zero the 8th bit), but base64 covers multibyte ones too like classic Unicode (UTF-16) or UTF-32 so it's better to use that for any non us-ascii encoding (including Greek, Russian etc.)

11/28/2009 3:04:56 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

btw, regarding display names and stores, my experience with OSCommerce is that it supports the store name in the from field and decent e-mail clients should show both the (decoded) display name and the e-mail address in the format that .NET DisplayName property (see its ref) also shows, that is name <mail> if name is defined, else shows just mail (but not <mail>)

regarding phising, SMTP headers can be faked, it's totally unsafe anyway to trust

11/28/2009 3:05:12 PM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Ok, I missed that part. I will see about adding support for all of them then using the GetEncoding method and if it returns an argument exception I will log it and fall back to utf-8.

Best,

Joe

11/28/2009 3:08:05 PM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

you tell .NET to use TransferEncoding of base64

How do you do that? I did not see anything on the MailMessage or smtpclient classes to specify it?

btw, it is saturday evening I'm probably done with the forums for today.

Best,

Joe

11/28/2009 3:23:23 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Strange, it says "If you set the BodyEncoding property to UTF8, Unicode, or UTF32, the Framework selects a TransferEncoding of Base64 for this MailMessage.", but only AttachmentBase has way to set TransferEncoding (btw, there's also a SubjectEncoding property for MailMessage you have to take in mind).

I guess they have some internal property to set the TransferEncoding for the MailMessage (maybe a protected one that you could surface using a descendent class [if allows inheritance]), else the doc is wrong or misleading there.

I think I know what they do though, they use MIME/Multipart and make an empty main message and add an alternate view as attachment to the AlternateViews collection (the attachment allows you to use TransferEncoding). AlternateViews should also be used with HTML mails I guess.

Use the AlternateViews property to specify copies of an e-mail message in different formats. For example, if you send a message in HTML, you might also want to provide a plain text version in case some of the recipients use e-mail readers that cannot display HTML content.

To add an alternate view to a MailMessage object, create an Attachment for the view, and then add it to the collection returned by AlternateViews. Use the Body property to specify the text version and use the AlternateViews collection to specify views with other MIME types. Use the MediaTypeNames class members to specify the MIME type for the alternate view.

11/28/2009 3:31:39 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

I'll do a little search on it and let you know. The idea is that the "Content-Transfer-Encoding" header has to be set, but if you were to set the header directly somehow I think you'd have to base64 the content yourself. I think best is to check out BodyEncoding property implementation in Mono [else maybe use .NET Reflector on MS impl. - latest one available by RedGate, still for free - might be able to show some info] to see how it sets the TransferEncoding to base64 when the BodyEncoding is UTF-8/UTF-16/UTF-32 (I hope that they use some public calls to do that, not under the hood trickery).

11/28/2009 3:32:42 PM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

All of that sounds like a lot of complicated work, if you are interested in trying to implement it I will let you know once my current changes are in svn trunk. I did encode the subject same as the body as I saw that property and figured it needed to be the same.

The display name encoding issue also sounds like non trivial work, if that is important for you perhaps you would be willing to implement it.

For me these are not high priorities. I'm sure OSCommerce and others already have support for it and someday we will too, but in the grand scheme of things the mojoPortal WebStore needs a lot of things much more important than display name support in email as does mojoPortal in general. I need to stay on the priorities that I see as more important.

Best,

Joe

11/28/2009 3:34:44 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

I don't mind implementing it myself, I want to start playing with mojoPortal's code anyway and maybe it's a good chance to do it...

11/28/2009 3:36:25 PM
Gravatar
Total Posts 116
http://www.zoomicon.com http://birbilis.spaces.live.com http://www.delicious.com/birbilis http://twitter.com/Zoomicon

Re: non useful log about wrong e-mail address format

Does mojoPortal support HTML mails that have fallback plain text currently? (as AlternateViews [MIME/Multipart])

11/28/2009 3:36:54 PM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Awesome! I just started the merge, it will take several hours. I'll post again when it is complete.

Best,

Joe

11/28/2009 3:39:22 PM
Gravatar
Total Posts 18439

Re: non useful log about wrong e-mail address format

Does mojoPortal support HTML mails that have fallback plain text currently? (as AlternateViews [MIME/Multipart])

No, since that is not supported directly/easily on the .NET classes (as far as I know). DotNetOpenMail had that which was one of the things that attracted me to it originally. 

If you feel you can implement this as well it would be welcome help!

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.