Results 1 to 6 of 6

Thread: E-mailing with attachments in vb.net

  1. #1

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Question E-mailing with attachments in vb.net

    the following code is for emailing in vb .net but I get this error

    Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
    for this line
    message1.attachments.add("C:\Test.txt")




    message1 = CreateObject("CDO.Message")
    Conf = CreateObject("CDO.Configuration")
    Fields = Conf.Fields

    ' send one copy with Google SMTP server (with autentication)
    acsessing = "http://schemas.microsoft.com/cdo/configuration/"
    Fields.Item(acsessing & "sendusing") = 2
    Fields.Item(acsessing & "smtpserver") = dom
    Fields.Item(acsessing & "smtpserverport") = 465
    Fields.Item(acsessing & "smtpauthenticate") = 1
    Fields.Item(acsessing & "sendusername") = username
    Fields.Item(acsessing & "sendpassword") = ps.Text
    Fields.Item(acsessing & "smtpusessl") = 1
    Fields.Update()

    message1.To = tooo
    message1.From = username
    message1.Subject = subject
    message1.HTMLBody = body
    message1.Sender = sender1
    message1.ReplyTo = username
    message1.Configuration = Conf
    message1.attachments.add("C:\Test.txt")
    sendemailgmail = message1.Send
    can any one help me pls
    Last edited by demon.KILER; Jul 16th, 2006 at 11:21 AM.

  2. #2
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: plsssssssssssssss help help me plssssss

    I don't know how to fix your problem.
    What I do know is that you are more likely to get help if you change your subject to something a bit more meaningful...

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: plsssssssssssssss help help me plssssss

    Something meaningful and less annoying. If you've posted a question we know you want help. All that "plssss" makes me, for one, less likely to help.

    If you're getting a data type mismatch then it means that the data you're assigning to one of the fields is the wrong type. I'm guessing that it's this:
    VB Code:
    1. message1.Attachments.Add("C:\path")
    That looks like you're trying to attach a folder named "path", which ain't happening.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Re: E-mailing with attachments in vb.net

    I know that

  5. #5
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Re: E-mailing with attachments in vb.net

    I just have a suggestion = Google Indy.Sockets and go to the first page....
    "Imagination is more important than knowledge" - Albert Einstein, born on March 14th 1879.
    Can't find it here on VBForums? Go to the CodeProject. MSDN is your friend . I have such a bad website, my friend decided it would be funny to change the template and he moderates the site for me: visit my site!

    "Thinking of you, wherever you are
    We pray for our sorrows to end, and hope that our hearts will blend.
    Now I will step forward to realize this wish.
    And who knows, starting a new journey may not be so hard…
    Or maybe it has already begun.
    There are many worlds, but they share the same sky
    one sky, one destiny..."

  6. #6

    Thread Starter
    Hyperactive Member demon.KILER's Avatar
    Join Date
    Jul 2006
    Location
    I cannot remember !?
    Posts
    408

    Re: E-mailing with attachments in vb.net

    i didn't added the reffrance system.web that why it don't worked
    thx any way

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