Getting a CDONT parameter

Discussion in 'ASP General' started by Simon Wigzell, Feb 1, 2006.

  1. My website sends automatic emails from many (25) different places. I want to
    send a second email by reading the parameters of the first one. I don't want
    to have to repeat and maintain the assignment of the second email
    From,To,Subject fields so I am just using an include at each point in the
    code where I send an email:

    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.BodyFormat= 0
    MyCDONTSMail.MailFormat= 1
    MyCDONTSMail.From=
    MyCDONTSMail.To=
    MyCDONTSMail.Subject="some subject"
    MyCDONTSMail.Body= "some text":
    %>
    <!--#include file="SendFollowUpEmail.asp" -->
    <%
    MyCDONTSMail.Send
    set MyCDONTSMail=nothing
    -------------------------------------------------------------------------------
    The SendFollowUpEmail.asp just wants to take the From,To,Subject parameters
    that are defined in the original email and add a different body:

    Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
    MyCDONTSMail2.BodyFormat= 0
    MyCDONTSMail2.MailFormat= 1
    MyCDONTSMail2.From= MyCDONTSMail.From
    MyCDONTSMail2.To= MyCDONTSMail.To
    MyCDONTSMail2.Subject=MyCDONTSMail.Subject
    MyCDONTSMail2.Body= "some new text"
    MyCDONTSMail2.Send
    set MyCDONTSMail2=nothing

    It chokes on this:

    MyCDONTSMail2.From= MyCDONTSMail.From

    Object doesn't support this property or method: 'MyCDONTSMail.From'

    Seems to me MyCDONTSMail.From is only a string, why can't I retrieve its
    value? More to the point though - how can I retrieve its value?

    Thanks!
     
    Simon Wigzell, Feb 1, 2006
    #1
    1. Advertising

  2. Instead of doing that, just do:

    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.BodyFormat= 0
    MyCDONTSMail.MailFormat= 1
    MyCDONTSMail.From=
    MyCDONTSMail.Subject="some subject"
    MyCDONTSMail.Body= "some text":

    MyCDONTSMail.To=
    MyCDONTSMail.Send

    MyCDONTSMail.To=
    MyCDONTSMail.Send

    MyCDONTSMail.To=
    MyCDONTSMail.Send

    MyCDONTSMail.To=
    MyCDONTSMail.Send

    MyCDONTSMail.To=
    MyCDONTSMail.Send

    ....etc....

    Are you running this in a Windows NT server? If not, you shouldn't be using
    the old technology CDONTS. Please read:
    http://www.aspfaq.com/show.asp?id=2026

    Ray at work


    "Simon Wigzell" <> wrote in message
    news:Sy8Ef.409506$2k.270920@pd7tw1no...
    > My website sends automatic emails from many (25) different places. I want
    > to send a second email by reading the parameters of the first one. I don't
    > want to have to repeat and maintain the assignment of the second email
    > From,To,Subject fields so I am just using an include at each point in the
    > code where I send an email:
    >
    > Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    > MyCDONTSMail.BodyFormat= 0
    > MyCDONTSMail.MailFormat= 1
    > MyCDONTSMail.From=
    > MyCDONTSMail.To=
    > MyCDONTSMail.Subject="some subject"
    > MyCDONTSMail.Body= "some text":
    > %>
    > <!--#include file="SendFollowUpEmail.asp" -->
    > <%
    > MyCDONTSMail.Send
     
    Ray Costanzo [MVP], Feb 1, 2006
    #2
    1. Advertising

  3. Simon Wigzell wrote:
    > It chokes on this:
    >
    > MyCDONTSMail2.From= MyCDONTSMail.From


    Naturally. The [From] property is write-only:
    http://msdn.microsoft.com/library/en-us/cdo/html/36d01b22-2cb6-45f9-95d2-e536b8054c57.asp

    Use Ray's suggestion. Better yet, use CDO.



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Feb 1, 2006
    #3
  4. The from address and the to address and the subject aren't known in advance,
    I'm talking about a programmed website here.

    I just want to know if there is a way to retrieve what has been set into a
    CDONT structure, if it isn't possible then say so. I don't want to know a
    different way of programming my website, its working fine. So I guess I have
    to go back into all 25 pages where I do this and write specific code to send
    the second email because it is not possible to retrieve what has been set
    into a CDONT, ok, thanks.

    (Looking up at the sky and rolling eyes)


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:%...
    > Instead of doing that, just do:
    >
    > Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    > MyCDONTSMail.BodyFormat= 0
    > MyCDONTSMail.MailFormat= 1
    > MyCDONTSMail.From=
    > MyCDONTSMail.Subject="some subject"
    > MyCDONTSMail.Body= "some text":
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > ...etc....
    >
    > Are you running this in a Windows NT server? If not, you shouldn't be
    > using the old technology CDONTS. Please read:
    > http://www.aspfaq.com/show.asp?id=2026
    >
    > Ray at work
    >
    >
    > "Simon Wigzell" <> wrote in message
    > news:Sy8Ef.409506$2k.270920@pd7tw1no...
    >> My website sends automatic emails from many (25) different places. I want
    >> to send a second email by reading the parameters of the first one. I
    >> don't want to have to repeat and maintain the assignment of the second
    >> email From,To,Subject fields so I am just using an include at each point
    >> in the code where I send an email:
    >>
    >> Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    >> MyCDONTSMail.BodyFormat= 0
    >> MyCDONTSMail.MailFormat= 1
    >> MyCDONTSMail.From=
    >> MyCDONTSMail.To=
    >> MyCDONTSMail.Subject="some subject"
    >> MyCDONTSMail.Body= "some text":
    >> %>
    >> <!--#include file="SendFollowUpEmail.asp" -->
    >> <%
    >> MyCDONTSMail.Send

    >
    >
     
    Simon Wigzell, Feb 2, 2006
    #4
  5. Simon Wigzell

    Steven Burn Guest

    Not the best response if you want to continue getting help here ....

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Simon Wigzell" <> wrote in message
    news:CcfEf.306602$tl.107165@pd7tw3no...
    > The from address and the to address and the subject aren't known in

    advance,
    > I'm talking about a programmed website here.
    >
    > I just want to know if there is a way to retrieve what has been set into a
    > CDONT structure, if it isn't possible then say so. I don't want to know a
    > different way of programming my website, its working fine. So I guess I

    have
    > to go back into all 25 pages where I do this and write specific code to

    send
    > the second email because it is not possible to retrieve what has been set
    > into a CDONT, ok, thanks.
    >
    > (Looking up at the sky and rolling eyes)
    >
    >
    > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    > message news:%...
    > > Instead of doing that, just do:
    > >
    > > Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    > > MyCDONTSMail.BodyFormat= 0
    > > MyCDONTSMail.MailFormat= 1
    > > MyCDONTSMail.From=
    > > MyCDONTSMail.Subject="some subject"
    > > MyCDONTSMail.Body= "some text":
    > >
    > > MyCDONTSMail.To=
    > > MyCDONTSMail.Send
    > >
    > > MyCDONTSMail.To=
    > > MyCDONTSMail.Send
    > >
    > > MyCDONTSMail.To=
    > > MyCDONTSMail.Send
    > >
    > > MyCDONTSMail.To=
    > > MyCDONTSMail.Send
    > >
    > > MyCDONTSMail.To=
    > > MyCDONTSMail.Send
    > >
    > > ...etc....
    > >
    > > Are you running this in a Windows NT server? If not, you shouldn't be
    > > using the old technology CDONTS. Please read:
    > > http://www.aspfaq.com/show.asp?id=2026
    > >
    > > Ray at work
    > >
    > >
    > > "Simon Wigzell" <> wrote in message
    > > news:Sy8Ef.409506$2k.270920@pd7tw1no...
    > >> My website sends automatic emails from many (25) different places. I

    want
    > >> to send a second email by reading the parameters of the first one. I
    > >> don't want to have to repeat and maintain the assignment of the second
    > >> email From,To,Subject fields so I am just using an include at each

    point
    > >> in the code where I send an email:
    > >>
    > >> Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    > >> MyCDONTSMail.BodyFormat= 0
    > >> MyCDONTSMail.MailFormat= 1
    > >> MyCDONTSMail.From=
    > >> MyCDONTSMail.To=
    > >> MyCDONTSMail.Subject="some subject"
    > >> MyCDONTSMail.Body= "some text":
    > >> %>
    > >> <!--#include file="SendFollowUpEmail.asp" -->
    > >> <%
    > >> MyCDONTSMail.Send

    > >
    > >

    >
    >
     
    Steven Burn, Feb 2, 2006
    #5
  6. Well - I couldn't have been more explicit describing my problem and what I
    wanted to know, yet my problem remains unanswered and unadressed, meanwhile
    I have been given some unrelated and useless advice, so yes, you are
    probably right.


    "Steven Burn" <> wrote in message
    news:Ov$...
    > Not the best response if you want to continue getting help here ....
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > "Simon Wigzell" <> wrote in message
    > news:CcfEf.306602$tl.107165@pd7tw3no...
    >> The from address and the to address and the subject aren't known in

    > advance,
    >> I'm talking about a programmed website here.
    >>
    >> I just want to know if there is a way to retrieve what has been set into
    >> a
    >> CDONT structure, if it isn't possible then say so. I don't want to know a
    >> different way of programming my website, its working fine. So I guess I

    > have
    >> to go back into all 25 pages where I do this and write specific code to

    > send
    >> the second email because it is not possible to retrieve what has been set
    >> into a CDONT, ok, thanks.
    >>
    >> (Looking up at the sky and rolling eyes)
    >>
    >>
    >> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    >> message news:%...
    >> > Instead of doing that, just do:
    >> >
    >> > Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    >> > MyCDONTSMail.BodyFormat= 0
    >> > MyCDONTSMail.MailFormat= 1
    >> > MyCDONTSMail.From=
    >> > MyCDONTSMail.Subject="some subject"
    >> > MyCDONTSMail.Body= "some text":
    >> >
    >> > MyCDONTSMail.To=
    >> > MyCDONTSMail.Send
    >> >
    >> > MyCDONTSMail.To=
    >> > MyCDONTSMail.Send
    >> >
    >> > MyCDONTSMail.To=
    >> > MyCDONTSMail.Send
    >> >
    >> > MyCDONTSMail.To=
    >> > MyCDONTSMail.Send
    >> >
    >> > MyCDONTSMail.To=
    >> > MyCDONTSMail.Send
    >> >
    >> > ...etc....
    >> >
    >> > Are you running this in a Windows NT server? If not, you shouldn't be
    >> > using the old technology CDONTS. Please read:
    >> > http://www.aspfaq.com/show.asp?id=2026
    >> >
    >> > Ray at work
    >> >
    >> >
    >> > "Simon Wigzell" <> wrote in message
    >> > news:Sy8Ef.409506$2k.270920@pd7tw1no...
    >> >> My website sends automatic emails from many (25) different places. I

    > want
    >> >> to send a second email by reading the parameters of the first one. I
    >> >> don't want to have to repeat and maintain the assignment of the second
    >> >> email From,To,Subject fields so I am just using an include at each

    > point
    >> >> in the code where I send an email:
    >> >>
    >> >> Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    >> >> MyCDONTSMail.BodyFormat= 0
    >> >> MyCDONTSMail.MailFormat= 1
    >> >> MyCDONTSMail.From=
    >> >> MyCDONTSMail.To=
    >> >> MyCDONTSMail.Subject="some subject"
    >> >> MyCDONTSMail.Body= "some text":
    >> >> %>
    >> >> <!--#include file="SendFollowUpEmail.asp" -->
    >> >> <%
    >> >> MyCDONTSMail.Send
    >> >
    >> >

    >>
    >>

    >
    >
     
    Simon Wigzell, Feb 2, 2006
    #6
  7. On Thu, 02 Feb 2006 06:46:33 GMT, "Simon Wigzell" <> wrote:
    in <dVhEf.534342$ki.526673@pd7tw2no>

    >Well - I couldn't have been more explicit describing my problem and what I
    >wanted to know, yet my problem remains unanswered and unadressed, meanwhile
    >I have been given some unrelated and useless advice, so yes, you are
    >probably right.


    Oh I understand. This is something like "My mind is made up. Don't confuse me
    with the facts!"

    No problem.

    ---
    Stefan Berglund
     
    Stefan Berglund, Feb 2, 2006
    #7
  8. and here is another very good cdosys article

    http://www.powerasp.com/content/new/sending_email_cdosys.asp


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:%...
    > Instead of doing that, just do:
    >
    > Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    > MyCDONTSMail.BodyFormat= 0
    > MyCDONTSMail.MailFormat= 1
    > MyCDONTSMail.From=
    > MyCDONTSMail.Subject="some subject"
    > MyCDONTSMail.Body= "some text":
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > MyCDONTSMail.To=
    > MyCDONTSMail.Send
    >
    > ...etc....
    >
    > Are you running this in a Windows NT server? If not, you shouldn't be
    > using the old technology CDONTS. Please read:
    > http://www.aspfaq.com/show.asp?id=2026
    >
    > Ray at work
    >
    >
    > "Simon Wigzell" <> wrote in message
    > news:Sy8Ef.409506$2k.270920@pd7tw1no...
    >> My website sends automatic emails from many (25) different places. I want
    >> to send a second email by reading the parameters of the first one. I
    >> don't want to have to repeat and maintain the assignment of the second
    >> email From,To,Subject fields so I am just using an include at each point
    >> in the code where I send an email:
    >>
    >> Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    >> MyCDONTSMail.BodyFormat= 0
    >> MyCDONTSMail.MailFormat= 1
    >> MyCDONTSMail.From=
    >> MyCDONTSMail.To=
    >> MyCDONTSMail.Subject="some subject"
    >> MyCDONTSMail.Body= "some text":
    >> %>
    >> <!--#include file="SendFollowUpEmail.asp" -->
    >> <%
    >> MyCDONTSMail.Send

    >
    >
     
    Kyle Peterson, Feb 2, 2006
    #8
  9. I apologise for being cranky, just one of those days.

    I have been progrmaming for 20 years and never met a language or structure
    where you could assign a value to something but not get it back. My intent
    here was to try to do something once, instead I ahve to do it 25 times. Oh
    well, c'est la vie.

    Again, I apologise for my cranky ungrateful comments to your well meaning
    replies!
     
    Simon Wigzell, Feb 3, 2006
    #9
  10. Simon Wigzell

    Roland Hall Guest

    "Stefan Berglund" wrote in message
    news:...
    : On Thu, 02 Feb 2006 06:46:33 GMT, "Simon Wigzell" <>
    wrote:
    : in <dVhEf.534342$ki.526673@pd7tw2no>
    :
    : >Well - I couldn't have been more explicit describing my problem and what
    I
    : >wanted to know, yet my problem remains unanswered and unadressed,
    meanwhile
    : >I have been given some unrelated and useless advice, so yes, you are
    : >probably right.
    :
    : Oh I understand. This is something like "My mind is made up. Don't
    confuse me
    : with the facts!"
    :
    : No problem.

    I like that response! Sorry Simon.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Feb 3, 2006
    #10
  11. Simon Wigzell

    Roland Hall Guest

    "Simon Wigzell" wrote in message news:Sy8Ef.409506$2k.270920@pd7tw1no...
    : My website sends automatic emails from many (25) different places. I want
    to
    : send a second email by reading the parameters of the first one. I don't
    want
    : to have to repeat and maintain the assignment of the second email
    : From,To,Subject fields so I am just using an include at each point in the
    : code where I send an email:
    :
    : Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    : MyCDONTSMail.BodyFormat= 0
    : MyCDONTSMail.MailFormat= 1
    : MyCDONTSMail.From=
    : MyCDONTSMail.To=
    : MyCDONTSMail.Subject="some subject"
    : MyCDONTSMail.Body= "some text":
    : %>
    : <!--#include file="SendFollowUpEmail.asp" -->
    : <%
    : MyCDONTSMail.Send
    : set MyCDONTSMail=nothing
    : -------------------------------------------------------------------------------
    : The SendFollowUpEmail.asp just wants to take the From,To,Subject
    parameters
    : that are defined in the original email and add a different body:
    :
    : Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
    : MyCDONTSMail2.BodyFormat= 0
    : MyCDONTSMail2.MailFormat= 1
    : MyCDONTSMail2.From= MyCDONTSMail.From
    : MyCDONTSMail2.To= MyCDONTSMail.To
    : MyCDONTSMail2.Subject=MyCDONTSMail.Subject
    : MyCDONTSMail2.Body= "some new text"
    : MyCDONTSMail2.Send
    : set MyCDONTSMail2=nothing
    :
    : It chokes on this:
    :
    : MyCDONTSMail2.From= MyCDONTSMail.From
    :
    : Object doesn't support this property or method: 'MyCDONTSMail.From'
    :
    : Seems to me MyCDONTSMail.From is only a string, why can't I retrieve its
    : value? More to the point though - how can I retrieve its value?

    There is a lot of ways to do it. As you said the values are not known so
    just pass variables to it when the values are known. It could even be
    session variables.

    What you do it make it a subroutine.

    sub sendMail(mailFrom, mailTo, mailSubject, mailBody)
    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.BodyFormat = 0
    MyCDONTSMail.MailFormat = 1
    MyCDONTSMail.From = mailFrom
    MyCDONTSMail.To = mailTo
    MyCDONTSMail.Subject = mailSubject
    MyCDONTSMail.Body= mailBody
    end sub

    With the follow up, just pass the different values to it.
    sendMail "", "", "My Subject", "Here is my
    message!"

    If your message body is formatted, pass it as a variable.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Feb 3, 2006
    #11
    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. michaaal
    Replies:
    1
    Views:
    134
    Evertjan.
    Jul 9, 2003
  2. Mark

    CDONT-Autoresponder

    Mark, Jul 28, 2003, in forum: ASP General
    Replies:
    1
    Views:
    114
    Aaron Bertrand - MVP
    Jul 28, 2003
  3. Gonzosez

    cdont problem

    Gonzosez, Feb 6, 2004, in forum: ASP General
    Replies:
    1
    Views:
    104
    Ray at
    Feb 6, 2004
  4. Harvey Waxman

    CDONT to CDO

    Harvey Waxman, Feb 28, 2004, in forum: ASP General
    Replies:
    9
    Views:
    164
    Aaron Bertrand [MVP]
    Apr 15, 2004
  5. Simon Wigzell

    CDONT and HTML email line wrap problem

    Simon Wigzell, Jan 26, 2005, in forum: ASP General
    Replies:
    1
    Views:
    158
    Adrienne
    Jan 27, 2005
Loading...

Share This Page