Newbie Q: Is it possible to send an email + attachment from inside script (no forms)

Discussion in 'Javascript' started by Paul Moore, Jun 3, 2007.

  1. Paul Moore

    Paul Moore Guest

    I have a script which generates a text file. Is it possible from within the
    same script to send the file to a mail list as an attachment, without using
    a form? No, it's not to send spam :<).

    I've googled the web, and all the examples I've seen use a form to specify
    the recipient address, subject, etc.

    Many thanks,
    Paul
     
    Paul Moore, Jun 3, 2007
    #1
    1. Advertising

  2. Paul Moore :
    > I have a script which generates a text file. Is it possible from within the
    > same script to send the file to a mail list as an attachment, without using
    > a form?

    Why you asked this question in javascript group ?
    Yes. It is possible in any (or almost any) server side
    languages.
    >No, it's not to send spam :<).

    I'm not sure. :) I'm joking.
    >
    > I've googled the web, and all the examples I've seen use a form to specify
    > the recipient address, subject, etc.
    >
    > Many thanks,
    > Paul
     
    Georgi Naumov, Jun 3, 2007
    #2
    1. Advertising

  3. Paul Moore

    Paul Moore Guest

    Ed and Georgi,

    My script is written in javascript, but it not form based.
    You're both saying that it's not possible to send an email without using a
    form, right?

    Thanks,
    Paul


    "Ed Jay" <> wrote in message
    news:...
    > Paul Moore scribed:
    >
    >>I have a script which generates a text file. Is it possible from within
    >>the
    >>same script to send the file to a mail list as an attachment, without
    >>using
    >>a form? No, it's not to send spam :<).

    >
    > Yes, but you'll have to expand the script.
    >>
    >>I've googled the web, and all the examples I've seen use a form to specify
    >>the recipient address, subject, etc.
    >>

    > Unless you're querying a data base for recipient's addy's, etc., you have
    > to
    > use a form.
    >
    > Your questions are misplaced in this newsgroup. Ask the same questions in
    > a
    > newsgroup dedicated to the language your script is written in.
    > --
    > Ed Jay (remove 'M' to respond by email)
     
    Paul Moore, Jun 4, 2007
    #3
  4. Paul Moore

    Roy A. Guest

    On 4 Jun, 08:18, Ed Jay <> wrote:
    > Paul Moore scribed:
    >
    > >Ed and Georgi,

    >
    > >My script is written in javascript, but it not form based.
    > >You're both saying that it's not possible to send an email without using a
    > >form, right?


    It is possible to create and submit a form from javascript.

    > >>>I have a script which generates a text file. Is it possible from within
    > >>>the
    > >>>same script to send the file to a mail list as an attachment, without
    > >>>using
    > >>>a form?


    You can't. It's possible to create an <input type="file"...> object,
    but it will not be useful without user interaction. You can't fill it
    width generated content. To send an attachment, you have to use a
    form.

    Javascript has an fileupload object, the value
    "Reflects the current value of the file upload element's field; this
    corresponds to the name of the file to upload."

    http://hal.ific.uv.es/informatica/manuales/ClientReferenceJS13/fileup.html

    There is no other properties you can use
    http://www.w3.org/TR/html401/interact/forms.html#h-17.4
    http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6043025

    To submit your generated text file from javascript, you have to submit
    it from a <input type="text"...> or <input type="hidden"...> object,
    and have a script on the server to attach it to the email.

    So, no. It's not possible to send the file to a mail list as an
    attachment, without using a form.
     
    Roy A., Jun 4, 2007
    #4
  5. Paul Moore

    Paul Moore Guest

    Ok, many thanks for all your help.
    I'll have to find another solution, maybe from a command line script.

    Regards,
    Paul

    "Roy A." <> wrote in message
    news:...
    > On 4 Jun, 08:18, Ed Jay <> wrote:
    >> Paul Moore scribed:
    >>
    >> >Ed and Georgi,

    >>
    >> >My script is written in javascript, but it not form based.
    >> >You're both saying that it's not possible to send an email without using
    >> >a
    >> >form, right?

    >
    > It is possible to create and submit a form from javascript.
    >
    >> >>>I have a script which generates a text file. Is it possible from
    >> >>>within
    >> >>>the
    >> >>>same script to send the file to a mail list as an attachment, without
    >> >>>using
    >> >>>a form?

    >
    > You can't. It's possible to create an <input type="file"...> object,
    > but it will not be useful without user interaction. You can't fill it
    > width generated content. To send an attachment, you have to use a
    > form.
    >
    > Javascript has an fileupload object, the value
    > "Reflects the current value of the file upload element's field; this
    > corresponds to the name of the file to upload."
    >
    > http://hal.ific.uv.es/informatica/manuales/ClientReferenceJS13/fileup.html
    >
    > There is no other properties you can use
    > http://www.w3.org/TR/html401/interact/forms.html#h-17.4
    > http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6043025
    >
    > To submit your generated text file from javascript, you have to submit
    > it from a <input type="text"...> or <input type="hidden"...> object,
    > and have a script on the server to attach it to the email.
    >
    > So, no. It's not possible to send the file to a mail list as an
    > attachment, without using a form.
    >
     
    Paul Moore, Jun 4, 2007
    #5
  6. Paul Moore

    Paul Moore Guest

    Everyone,

    I just found this. It seems to solve my problems.

    http://www.codeproject.com/useritems/Exsead8.asp

    Paul


    "Paul Moore" <> wrote in message
    news:%FF8i.212597$-ops.be...
    >I have a script which generates a text file. Is it possible from within the
    > same script to send the file to a mail list as an attachment, without
    > using
    > a form? No, it's not to send spam :<).
    >
    > I've googled the web, and all the examples I've seen use a form to specify
    > the recipient address, subject, etc.
    >
    > Many thanks,
    > Paul
    >
    >
     
    Paul Moore, Jun 4, 2007
    #6
    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. Sam
    Replies:
    1
    Views:
    424
  2. yihan
    Replies:
    3
    Views:
    508
    Thomas Weidenfeller
    Nov 10, 2004
  3. zhao wang

    How to send the email attachment

    zhao wang, Jan 3, 2005, in forum: Java
    Replies:
    2
    Views:
    438
    Ajith KR via JavaKB.com
    Jan 4, 2005
  4. Andrew Chan
    Replies:
    0
    Views:
    431
    Andrew Chan
    Dec 1, 2004
  5. Andrew Chan
    Replies:
    0
    Views:
    638
    Andrew Chan
    Dec 1, 2004
Loading...

Share This Page