Send Mail with PHP, ASP, or Perl

Finally, Perl
Chad "Cota" Workman
http://www.chadworkman.com & http://www.plaguestudio.com
Skills include: Photoshop, Flash, ASP, PHP, MS SQL, MySQL, VB, C/C+
Developer and Designer
Ok, one final server side method. For those that for some reason can't use ASP or PHP you can use Perl. Perl is one of those server side scripts that doesn't care if you're using Unix/Linux or Windows, it will run on both. There are 2 Perl files, don't worry about the "SubParse" file, just focus on the main file, "SendMail.cgi". Here's the code:
#!/usr/local/bin/perl
require "subparse.lib";
&Parse_Form;
$theMail = $formdata{'email_txt'};
$theSubject = $formdata{'subject_txt'};
$theMessage = $formdata{'message_txt'};
open (MAIL, "|/usr/sbin/sendmail -t") || &ErrorMessage;
print MAIL "To: $theMail \nFrom: $theMail\n";
print MAIL "Subject: $theSubject\n";
print MAIL "$theMessage\n";
close (MAIL);
print "Content-type: text/html\n\n";
Print "&server_mes=ok";
sub ErrorMessage {
print "&server_mes=Fail";
exit; }
So there you have it. Sending mail through flash with 3 methods. Which to use it completely up to you. Modifying the code is fairly easy if you just follow the blue prints that have been laid out for you.
Spread The Word
Attachments
9 Responses to "Send Mail with PHP, ASP, or Perl" 
|
said this on 22 Feb 2007 6:39:28 PM CDT
Not bad....
Remember tu encode your doc-type with utf-8, to allow forigners to send mail in flash also. Could have been nice if you used an example with the flash.net.FileReference class, to attach files in an email |
|
said this on 22 Apr 2007 3:53:53 AM CDT
Code doesn't work
//email failed to send, but script did load. Likely a server issue. status_txt.text = "Email Failed"; Tested program on to different servers |
|
said this on 22 Apr 2007 12:06:10 PM CDT
Most likely a server issue. You can contact me via email for assistance.
|
|
said this on 25 Apr 2007 8:57:35 PM CDT
Script works great only minor error in PHP script see below
PHP code has error. This line: $to = <a href="mailto:'your@email.address'">'your@email.address'</a> should read $to = 'your@email.address' Your var should not be a hyperlink PHP does not understand |
|
said this on 23 May 2007 2:41:56 AM CDT
great! but u have error in line:
if (!email_txt.length || email_txt.indexOf("@") == -1 || email_txt.indexOf(".") == -1) { it should looks like if (email_txt.length<=1 || email_txt.text.indexOf("@") == -1 || email_txt.text.indexOf(".") == -1) { |
|
said this on 12 Jun 2007 2:06:09 PM CDT
Very well written with lots of comments.
|
|
said this on 17 Jun 2007 11:18:01 AM CDT
Couldn't get it to work. I would submit and it would just hang. It would say on the little left corner "Transferring data from..." and then just hang there. What permissions do I put the php file. 644? Ive tried 777 and all combo and still no luck.
|
|
said this on 23 Jul 2007 8:29:06 AM CDT
I couldn't get this to work, so I downloaded the zip file, uploaded it EXACTLY as is, only changing the processing page to PHP, and nothing happens when I click the submit button?
|
|
said this on 07 Nov 2007 11:14:11 AM CDT
edit for ASP:
objmail.From = request("email_txt") objmail.To = request("email_txt") objmail.Subject = request("subject_txt") objmail.Body = request("message_txt") |



Author/Admin)