Groups | Blog | Home
all groups > flash (macromedia) > june 2005 >

flash (macromedia) : email without external handler - flash mx



George Harold Hartshorn III
6/22/2005 4:11:42 PM
This can be done with flash 3 ...bygeorge



[quoted text, click to view]

Eternal Student
6/22/2005 8:55:53 PM
Dear All,

I was wondering whether anyone out there could help me....

I have a contact page on my new flash website, with three form fields - t1,
t2, t3. I have scripted a reset / clear button to clear the fields, although I
am having trouble with a send button... It is possible to have a button
script that will collect the information from the three form fields (t1-t3) and
mail it to me@mysite.com - without the need for using external .php or .asp
files? I would prefer to keep all of the mailto script within the complied
..swf. I am not after anything fancy...just a simple script that will do this
task.

Please help.... before I loose some more sanity over this one! ;-)

Many Thanx,

Eternal Student.
sly one
6/22/2005 10:41:15 PM
BronwynL
8/1/2005 12:00:00 AM
Actually, couldn't you just append your fields to the mailto like you can in
Javascript? You'd need to build the string to pass, as in:
F1 = form.t1.value;
F2 = form.t2.value;
F3 = form.t3.value; (or however you get that in Actionscript)
theStr = "t1="+F1+"t2="+F2+"t3="+F3;

mailto:whoever@wherever.com?Subject=Subject&body=theStr
Just a thought. I can't even get the @#$% mailto: to work.
Eternal Student
8/1/2005 12:00:00 AM
Dear All,

Thank you for replying to my original request..... @ first I did not want to
use a php mail script or the users default mail client. But in the end I
crumbled under the pressure and used an external php file with the following
code within the flash movie - it was a pain to get working, but after tweeking
some of the variables - it works like a charm!

_lv = new LoadVars();
_lv.onLoad = function() {
if (!this.faultCode) {
response_txt.text = "Thank you - your message has been sent.";
} else {
response_txt.text = "Thank you - your message has been sent.";
}
};

send_bmc.onRelease = function() {
response_txt.text = '';
var ok = true;

if (subject_txt.text == '') _lv.subject = "Whatever default subject you want";
else _lv.subject = subject_txt.text;

if (name_txt.text == '') {
response_txt.text = "Please enter your name";
ok = false;
} else _lv.name = name_txt.text;

if (email_txt.text == '' || email_txt.text.indexOf('@') == -1) {
response_txt.text = "Please enter your email address";
ok = false;
} else _lv.email = email_txt.text;

if (message_txt.text == '') {
response_txt.text = "You haven't typed in a message";
ok = false;
} else _lv.message = message_txt.text;

if (ok) {
response_txt.text = "Sending...";
_lv.sendAndLoad("sendemail.php", _lv, "POST");
}
};

Selection.setFocus("subject_txt");
snah
8/1/2005 12:00:00 AM
snah
8/1/2005 12:00:00 AM
snah
8/1/2005 6:05:21 AM
I think this is not possible:
mailto:whoever@wherever.com?Subject=Subject&body=theStr

For sending vars as an email I use this:

// send variables to the ASP page

SendMail = new LoadVars();
SendMail.email = email_txt.text;
SendMail.subject = subject_txt.text;
SendMail.body = body_txt.text;
SendMail.sendAndLoad("forms/send_mail.asp", "POST");


Originally posted by: BronwynL
Actually, couldn't you just append your fields to the mailto like you can in
Javascript? You'd need to build the string to pass, as in:
F1 = form.t1.value;
F2 = form.t2.value;
F3 = form.t3.value; (or however you get that in Actionscript)
theStr = "t1="+F1+"t2="+F2+"t3="+F3;

mailto:whoever@wherever.com?Subject=Subject&body=theStr
Just a thought. I can't even get the @#$% mailto: to work.


McFry
8/1/2005 6:10:35 AM
Originally posted by: BronwynL
Actually, couldn't you just append your fields to the mailto like you can in
Javascript? You'd need to build the string to pass, as in:
F1 = form.t1.value;
F2 = form.t2.value;
F3 = form.t3.value; (or however you get that in Actionscript)
theStr = "t1="+F1+"t2="+F2+"t3="+F3;

mailto:whoever@wherever.com?Subject=Subject&body=theStr
Just a thought. I can't even get the @#$% mailto: to work.


While you could do this, you have to keep in mind that there are plenty of
people who do not use their default email application to actually send their
mail (mainly people who use web-based email applications). And because using
this method, as we know, would open up the user's default mail client with all
of the fields filled in, there's a good chance that the user will either be
unable to send the email. In addition, this method generally looks
unprofessional (as a user I always ask: why not just give me a link to write
and send the email to, when that's essentially what I'm doing anyway?).

Other than the mailto: solution, there are no options to send email from your
flash application without using some sort of data transfer solution (ie via
back-end script). I will add, though, that php is quite easy to learn, and you
would probably be able to write the required back-end script to do this in one
day (that's without any prior PHP experience). Hope this helps!
McFry
8/1/2005 6:16:10 AM
Originally posted by: snah
I think this is not possible:
mailto:whoever@wherever.com?Subject=Subject&body=theStr

For sending vars as an email I use this:

// send variables to the ASP page

SendMail = new LoadVars();
SendMail.email = email_txt.text;
SendMail.subject = subject_txt.text;
SendMail.body = body_txt.text;
SendMail.sendAndLoad("forms/send_mail.asp", "POST");



This would work. Set the text field to be dynamic and html enabled, and then
set the htmlText property of it.

textField.htmlText = "<a href='mailto:"+theStr+"'>link</a>";
snah
8/1/2005 6:23:39 AM
Yes sure, but BronwynL wanted to send variables ( form fields - t1, t2, t3)
from email.

Originally posted by: McFry
Originally posted by: snah
I think this is not possible:
mailto:whoever@wherever.com?Subject=Subject&body=theStr

For sending vars as an email I use this:

// send variables to the ASP page

SendMail = new LoadVars();
SendMail.email = email_txt.text;
SendMail.subject = subject_txt.text;
SendMail.body = body_txt.text;
SendMail.sendAndLoad("forms/send_mail.asp", "POST");



This would work. Set the text field to be dynamic and html enabled, and then
set the htmlText property of it.

textField.htmlText = "<a href='mailto:"+theStr+"'>link</a>";


McFry
8/1/2005 6:31:29 AM
Eternal's unclear, but it sounds like the desired functionality is to send an
email to the given address, by any means, without using a back-end script. It's
not specified that Eternal wishes to use the user's local email app.
AddThis Social Bookmark Button