PDA

View Full Version : Email not working, why?


ljones
02-06-2008, 07:37 PM
I'm trying to use CyanBlue's email routine and cannot get it to work.

AS:

function sendMail () {
var email_lv = new LoadVars ();
email_lv.fromFname = targetTemp.from_fname;
email_lv.fromLname = targetTemp.from_lname;
email_lv.fromEmail = targetTemp.from_email;
email_lv.toFname = targetTemp.to_fname;
email_lv.toLname = targetTemp.to_lname;
email_lv.toEmail = targetTemp.to_email;
email_lv.toMessage = targetTemp.to_message;
email_lv.share = targetTemp.shareScore.value;
email_lv.subscribe = targetTemp.subscribe.value;
email_lv.onLoad = function (ok) {
if (ok) {
trace ("Email Sent!!!");
trace (unescape (this));
targetTemp.gotoAndStop ('mailSent');
} else {
trace ("Problem sending an Email!!!");
}
};
email_lv.sendAndLoad ("sendEmail.php",email_lv,"POST");
}

PHP:sendEmail.php
<?php
if ($_POST)
{
$mailTo = $_POST['toEmail'];
$mailSubject = "[Contact] Website Contact from - (" . $_POST['fromFname'] . ")";
$Header = "MIME-Version: 1.0\r\n";
$Header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$Header .= "From: " . $_POST['fromEmail'] . "\r\n";
$output = "<BR>";
$output .= "From : " . $_POST['fromFname'] . "<BR><BR>";
$output .= "Email : " . $_POST['fromEmail'] . "<BR><BR>";
$output .= "Message : " . $_POST['toMessage'] . "<BR><BR>";
$output = nl2br($output);
if (mail($mailTo, $mailSubject, stripslashes($output), $Header))
{
echo("&result=1&");
}
else
{
echo("&result=2&");
}
}
else
{
echo("This script runs only in Flash!!!");
}
?>

Thanks for your time.

CyanBlue
02-06-2008, 09:01 PM
Um... Can you define what's not working???

ljones
02-06-2008, 10:48 PM
After submitting the email, the form is sent to the 'mailSent' frame, but the email simply never shows up.

CyanBlue
02-07-2008, 01:12 PM
Can you create a simple PHP script that does mail() and hard code everything, run that over the web browser and see if that works???

ljones
02-07-2008, 02:41 PM
CyanBlue-

Thanks for your reply. I got it working, but needed to get a script from the host's codebank that is geared to them. Ugh, frustrating. Which host do you use?

CyanBlue
02-07-2008, 02:45 PM
Some hosts set up in a way so that you have to do some specific thing to do to email and whatever else... Can you post what you have got from the host???

I am using the same host AS.org is using... It's called WebScorpion...
http://www.webscorpion.com/

ljones
02-07-2008, 03:12 PM
<?php
//EMAIL FORM CONFIGURATION VALUES********************************
if ($_POST)
{
//Hosted email account you are sending from
$fname =$_POST['fromFname'] ;
$lname = $_POST['fromLname'] ;
$emailAddress = $_POST['fromEmail'] ;
//Email address you are sending to
$emailPassword = 'myPassword';
$emailHostname = 'myEmailHostName';
$sendToEmailAddress = 'myEmail@DOMAIN';
//The subject line of the email
$subject = 'TESTING EMAIL';
$message = '' ;
foreach ($_POST as $key => $value){
$message .= $key . " : " . $value . "<BR><BR>\r\n";
}
require("c:\php\includes\class.phpmailer.php");

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->IsHTML(true);
$mail->Host = $emailHostname;
$mail->Username = $emailAddress;
$mail->Password = $emailPassword;
$mail->From = $emailAddress;
$mail->FromName = $fname . ' ' .$lname;
$mail->AddAddress($sendToEmailAddress);
$mail->Subject = $subject;
$mail->Body = $message;

if (@$mail->Send())
{
echo("&result=1&");
}
else
{
echo("&result=2&");
}
}
?>

That's basically it, although it will only send to a hosted email, so this would really be more of a "feedback/contact us" type of email, and I'm really looking to get a "send to a friend" type of email. Does that make sense? Is there some workaround, like "Reply-to". I'm confused, I think... :eek:

CyanBlue
02-07-2008, 03:37 PM
So, if you do $sendToEmailAddress = 'myFriend@OtherDOMAIN.com'; it won't send out an email???

ljones
02-07-2008, 04:28 PM
That seems to be the case.

CyanBlue
02-07-2008, 04:36 PM
Then, I guess this has to do with how your host is setting things up... Maybe they have set some sort of limitation... Time to pick up the phone and call them... Let me know what you hear from them... ;)

ljones
02-07-2008, 04:46 PM
At the same time checking out webscorpion. I suppose you don't have these kinds of issues with them.

One other side note: I'm looking into having users create their own multimedia presentations online, and they'd need to be able to zip all their files and download once they're done. Then they'd be able to run the projector or post them online. The final files could/would be massive. Any ideas on how to approach this? My current host doesn't allow for zipping on the fly over 2mb (I believe that's the limit)

CyanBlue
02-07-2008, 06:15 PM
No, my files are hosted in the server webscorpion manages, and I get 'test' emails every day, so I am assuming that it still works fine...

2MB is the default value PHP sets up, and not many hosts changes that for you... You probably need the dedicated server so that you have a control over those stuff...