mail attachment program using mailmessage

Discussion in 'ASP General' started by Deep, Jun 14, 2010.

  1. Deep

    Deep Guest

    Dear friends,
    Is it possible to write mail attachment program usig cdo.message
    component. if yes please tell me how to do it?
    I am doing like this and it is giving error
    -------------------
    Error Type:
    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'AttachFile'
    /asp/mailAttach.asp, line 28
    --------------------

    strEmail_attach = request("txtFile")

    Set newmail = server.CreateObject ("CDO.Message")

    newmail.from = ""
    newmail.to = ""
    newmail.subject = "Appear For First level Exam"

    If strEmail_attach <> "" then
    newmail.AttachFile(strEmail_attach)
    End If

    newmail.HTMLBody = "Hi how r u"
    newmail.send
    Set newmail = Nothing
     
    Deep, Jun 14, 2010
    #1
    1. Advertising

  2. Deep

    Bob Barrows Guest

    Deep wrote:
    > Dear friends,
    > Is it possible to write mail attachment program usig cdo.message
    > component. if yes please tell me how to do it?
    > I am doing like this and it is giving error
    > -------------------
    > Error Type:
    > Microsoft VBScript runtime (0x800A01B6)
    > Object doesn't support this property or method: 'AttachFile'
    > /asp/mailAttach.asp, line 28
    > --------------------
    >
    > strEmail_attach = request("txtFile")
    >
    > Set newmail = server.CreateObject ("CDO.Message")
    >
    > newmail.from = ""
    > newmail.to = ""
    > newmail.subject = "Appear For First level Exam"
    >
    > If strEmail_attach <> "" then
    > newmail.AttachFile(strEmail_attach)
    > End If
    >
    > newmail.HTMLBody = "Hi how r u"
    > newmail.send
    > Set newmail = Nothing


    I'm not sure where you found that AttachFile method ... here's the right
    way:
    http://www.paulsadowski.com/wsh/cdo.htm
    There are also examples here:
    http://www.aspfaq.com/search.asp?q=cdo attach


    --
    HTH,
    Bob Barrows
     
    Bob Barrows, Jun 14, 2010
    #2
    1. Advertising

  3. Deep

    Evertjan. Guest

    Deep wrote on 14 jun 2010 in microsoft.public.inetserver.asp.general:

    > Dear friends,
    > Is it possible to write mail attachment program usig cdo.message
    > component. if yes please tell me how to do it?
    > I am doing like this and it is giving error
    > -------------------
    > Error Type:
    > Microsoft VBScript runtime (0x800A01B6)
    > Object doesn't support this property or method: 'AttachFile'
    > /asp/mailAttach.asp, line 28
    > --------------------
    >
    > strEmail_attach = request("txtFile")

    [..]
    > newmail.AttachFile(strEmail_attach)


    Did you read the specs of CDO,
    or dit you just pick some code from the web
    witout looking what object was created?

    ..AttachFile is CDONT

    ..AddAttachment is CDO

    <http://www.devguru.com/features/tutorials/cdonts/cdonts.html>

    ==================================

    more:

    1 the () are not necessary induces difficult bugs
    if later on you ad a second parameter:

    newmail.AddAttachment strEmail_attach

    2 Warning: the file should be on the server, while the querystring comes
    from the client.

    3 Better use Server.mappath() if the querystring contains wwwroot
    adressing:

    newmail.AddAttachment Server.mappath(strEmail_attach)

    3 request("txtFile") is to symplistic, induces difficult bugs, use:

    request.form("txtFile")
    or
    request.querystring("txtFile")

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 14, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bertus Dam
    Replies:
    5
    Views:
    900
    Bertus Dam
    Aug 29, 2003
  2. stuart
    Replies:
    1
    Views:
    2,626
    Jacky Kwok
    Nov 10, 2003
  3. martin
    Replies:
    5
    Views:
    2,133
    Hans Kesting
    Dec 19, 2003
  4. =?Utf-8?B?TWlja2VCb3k=?=

    Problem with System.Web.Mail.MailMessage and HTML mail

    =?Utf-8?B?TWlja2VCb3k=?=, Jun 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    944
    =?Utf-8?B?TWlja2VCb3k=?=
    Jun 21, 2005
  5. =?Utf-8?B?RXNzYQ==?=
    Replies:
    3
    Views:
    2,304
    Ray Booysen
    May 31, 2006
Loading...

Share This Page