CDO Email In Classic ASP Not Always Getting Through

Discussion in 'Classic ASP' started by PeteB, Nov 12, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello Group

    I have a problem with a CDO email from a classic ASP app going astray to some particular users. The code below is typical of what I'm using.

    I have two questions for someone knowlegable in this area:
    1) Can you set both an HTMLBody AND a TEXTBody on the same mail object (I've seen different takes on this) and
    2) Does the FROM email address have to be a real address?

    The code below seems to work ok for limited people who I've tested this with, but I'm wondering if less forgivable (e.g., text only) mail client or POP serverconfigurations might baulk at either of the points above.

    Thanks for any input on this.

    PeteB

    ***********
    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")
    ' Setting the SMTP Server
    Set Flds = objConfig.Fields
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
    Flds.update
    'Mail to the CANDIDATE
    if SendCandidateEmail then
    Set objMessage.Configuration = objConfig
    objMessage.To = request.Form("CandidateEmail")
    objMessage.From = "abc@def.com"
    objMessage.Subject = "Subject Here"
    objMessage.HTMLBody = TheBaseEmail
    TheBaseEmail = Replace(TheBaseEmail,"",vbcrlf)
    objMessage.TextBody = TheBaseEmail
    objMessage.fields.update
    objMessage.Send
    end if

    ***********
     
  2. Could you clarify astray?

    To: is an object of the recipient class that you can assign a string to as well.
    From: is just a string - I've never seen the from as an object

    Although, Its been forever since I used Colaboration Data Objects,
    I could swear there is a .messageType property
    that tells the message that its either html or text.

    I often get To and Recipeints mixed up.
    And From and Sender mixed up.

    I'm sure its just the differnt mail objects I've used over the years.

    hth

    P.S. I recall a web site CDONOW that had heaps and heaps of CDO coding example.
    And slipstick as well.

    Thanks,
    Barry G. Sumpter

    Post Edited (BarrySumpter) : 11/12/2005 10:36:43 PM GMT
     
  3. Hi Barry

    By 'astray' I mean mail that doesn't show up in the recipientinboxes. It does on most, just not on all.

    The questions still stand:


    1) Can you set both an HTMLBody AND a TEXTBody on the same mail object (I've seen different takes on this) and
    2) Does the FROM email address have to be a real address (as opposed to a bogus '[email protected]' one)?

    Thanks
     
  4. A little while ago I thought I had a problem like this but then I found that the spam filters on the recipients email were treating the mail as spam and putting it in a bulk folder which was only viewable when logged into webmail view. outlook express on users desktop did not know anything about it.

    maybe?
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    we see more and more ISP blocking email from invalid from domain. I suggest checking the from address before sending the email, you can use compnoent like ASPNETMX

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Hi

    Thanks for your comments.

    I asked the person in question, but it appears that there is nothing in their server-side inbox either.

    The problem APPEARS to be that if the mail is sent from the SMTP server with a FROM address as a non-existent person (e.g., [email protected]) then it doesn't get through. If the FROM address is set to something legitimate then it shows up fine.

    It's almost like their ISP is blocking mail based on the belief that the 'bogus' email address means it's unsolicited junk.

    Bottom line is, it seems like the sender address was the key.

    Thanks again.

    PeteB
     
  7. Hi PeterB,

    Thanks so much for posting your findings.

    I've just posted the same problem and solution with jmail.

    I'd have to agree with Bruce that more ISP's are blocking email from an invalid 'From:' domain.

    There are so many mail structures available I couldn't tell you how textbody and htmlbody works.
    Although I do see you are using colaboration data objects which I mastered a few years ago.
    But don't recall the HTMLBody property nor how cdo handles one when you update the other.
    Perhaps you'd be so kind as to test and tell us how it went.

    As html is still just text.
    My opinion is there should be just a simple switch the indicates how to actually display the body text.
    Either as html or as plain text.


    i.e. Dim flgDisplayBodyAsHTML ' as boolean - true/false - false(default) display as plain text

    hth





    Thanks,
    Barry G. Sumpter

    Post Edited (BarrySumpter) : 11/26/2005 1:21:36 AM GMT
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page