Page 2 of 2

Posted: Tue Sep 17, 2002 1:02 am
by Takuma
Does this work without verification?
smtp.npsis.com
And you said that if you try to send a e-mail using mail() like this->

Code: Select all

<?php
<?php 
mail("YOURADDRESS","SUBJECT","MESSAGE");  
?> 
?>
WHERE "YOURADDRESS" is your e-mail address it doesn't send the e-mail to you. If that's the case the PHP is not configured properly to send e-mails.

Posted: Thu Sep 19, 2002 3:10 pm
by dgarrett
yeah that works, even works with a variable in the, to, part, but if the bidy contains a variable it does not. What would happen instead of putting the $body variable in the mail finction, I was to put echo $body, same thing I imagine. It just does not like the contents of the body variable is my conclusion, what I can't seem to figure out...... I really don't want to use asp but I may be forced to here, and I really don't like asp, but have been ablr to make it work in the past -dustin

Posted: Thu Sep 19, 2002 3:28 pm
by jason

Code: Select all

<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";

$EmailBody = "'Sent By:' $FirstName 'Senders Email:' $Email 'Address:' $Address";

//$EmailFooter="This message was sent by: $FirstName  If you feel that you
//recieved this e-mail by accident please contact us at http://www.whitedotgroup.com";

//$Message = $EmailBody
//.$EmailFooter;

if ( mail($ToName, $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">") ) {
    echo 'I worked';
} else {
    echo 'I did not work';
}
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
?>
Try that...

Also, doing mail('string', 'etc', 'etc') doesn't work...it just doesn't throw up an error.

And, as a note, you only put an email into the email argument, not that funky brackets you had as well you had going on

Posted: Thu Sep 19, 2002 7:40 pm
by dgarrett
OK- This is a step in the right direction, error checking is great, wish I would have come up with this earlier, or myself for that matter. Thanks. SO the above code is in action and I get this responce. Unfortunatly.
Warning: Bad Message destination in U:\users\r\remedy\pages\dust_mail.php on line 14
I did not work
So again I am not shure what to do.

This is the URL I am entering manually to get the results
Could there be a URL encoding promblem with my manually entered variable in the address bar?

Posted: Thu Sep 19, 2002 10:06 pm
by jason

Code: Select all

<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";

$EmailBody = "'Sent By:' $FirstName 'Senders Email:' $Email 'Address:' $Address";

//$EmailFooter="This message was sent by: $FirstName  If you feel that you
//recieved this e-mail by accident please contact us at http://www.whitedotgroup.com";

//$Message = $EmailBody
//.$EmailFooter;

if ( mail($ToEmail, $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">") ) {
    echo 'I worked';
} else {
    echo 'I did not work';
}
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
?>

Ooops, I had $ToName where there should have been $ToEmail.

Posted: Fri Sep 20, 2002 12:39 am
by dgarrett
Thank you so much... It has finally worked. Even from flash. The code does not seem all too different from the original code I was working with in the begining. When use use mail() do you have to use variables? Can you just enter text. ie mail("dustin@dustin.net", "subject", "Body text");... Anyhow I am ever so grateful for the help -Dustin

Posted: Sat Sep 21, 2002 1:25 am
by jason
You can use either variables or constant strings, it doesn matter. The problem was this line in your original code:

Code: Select all

mail($ToName." <".$ToEmail.">", $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">");
In particular, you had this as the first argument:

Code: Select all

$ToName." <".$ToEmail.">"
So basically, you were sending mail() a email address like this:

Jason Lotito <jason@devnetwork.net>

And we all know that isn't a real email address. You just had to remove all that extra stuff and leave in the email address. :D