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

P

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? 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
 
G

Georgi Naumov

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.
 
P

Paul Moore

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
 
R

Roy A.

Paul Moore scribed:

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

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.
 
P

Paul Moore

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

Regards,
Paul
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top