Results 1 to 7 of 7

Thread: sending email from .NET

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    sending email from .NET

    I have an ASP.NET 1.1 (VB.net 2003) application that reads in an HTML file and emails it to a user. I am getting some quirky formatting problems. I'm using a web version of MS Exchange to receive the file.

    Before I go into specifics, is there anything obvious I need to know about emailing a file in HTML format? Here's some code:


    mymail.To = mailto
    mymail.From = "[email protected]"
    mymail.Priority = MailPriority.Normal
    mymail.BodyFormat = MailFormat.Html
    mymail.Subject = "Subject of message"
    mymail.Body = message
    SmtpMail.SmtpServer = "xxx.xxx.xxx.xxx"

    SmtpMail.Send(mymail)

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: sending email from .NET

    No, as long as you specify it as HTML format (which I see you are doing) there shouldn't be any problems..

    however if your actual emailing code is working, and its only formatting that you are having an issue with, then it may be that you are rendering HTML that is not compatible with the rendering engine of your client application that is receiving the file...

    I guess you will need to elaborate more, perhaps show an example.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: sending email from .NET

    Should the email page be just the <body> of an HTML page, or a full HTML page for showing up in an email? I read it in as a string and put it into mymail.Body.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: sending email from .NET

    Just the body I would imagine, unless you have any specific information in the head section that you need to keep.

    You can do some simple testing and send different HTML emails and see which ones format properly, and which ones don't. Then compare the 2 and see what is different.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: sending email from .NET

    Its formatting ok on most emails ( gmail, yahoo, etc) but one person is getting the email cut off halfway and another is getting bad formatting.

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: sending email from .NET

    what provider/email client do they use?

    Its probably working ok in gmail and yahoo because you are visiting those sites in IE, and its IE that is doing the rendering, not the email service.

    Have you looked at them in firefox to see if it works there too?

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: sending email from .NET

    Can you show us some sample HTML being generated?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width