Jump to content
php.lv forumi

php mail script. ziņa nepienāk uz e-mail


aywars

Recommended Posts

Labdien!

 

Tika izveidots html form. Form'ā ir 4 lauki: Vārds ($name), Email ($email), Tēma ($subject) un Ziņa ($msg). Mērķis: vēlos lai nospiežot Submit (Sūtīt), ziņa tiktu nosūtīta uz manu inbox e-mailu (xxx@inbox.lv). Ja kāds no laukiem netiek aizpildīts, attiecīgi jāatveras html failam "error.html", ja viss aizpildīts - "message_sent.html"

 

Izmantoju sekojošu php scriptu:

 

// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$subject = addslashes($_POST['subject']);
@$msg = addslashes($_POST['msg']);

// Validation
if (strlen($name) == 0 )
{
header("Location: error.html");
exit;
}

if (strlen($email) == 0 )
{
header("Location: error.html");
exit;
}

if (strlen($subject) == 0 )
{
header("Location: error.html");
exit;
}

if (strlen($msg) == 0 )
{
header("Location: error.html");
exit;
}

//Sending Email to form owner
$pfw_header = "From: $email\n"
 . "Reply-To: $email\n";
$pfw_subject = "jobfinder";
$pfw_email_to = "xxx@inbox.lv";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "name: $name\n"
. "email: $email\n"
. "subject: $subject\n"
. "msg: $msg\n"

@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header );

header("Location: message_sent.html");

?>

 

Pie form action norādīju ceļu uz šo php scriptu. Serveris atbalsta PHP. Aizpildot laukus, un, nospiežot Sūtīt, viss it kā ok - atveras html lapa "message_sent.html".

Problēma sekojoša: uz e-mail nepienāk ziņa (!).

Kur esmu pieļāvis kļūdu?

Link to comment
Share on other sites

Izmainiiju kodu taa (ceru, ka pareizi sapratu):

 

if(mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header )) {
header("Location: message_sent.html");
} else {
header("Location: error.html");
exit;
}

?>

 

Tagad, pat pareizi aizpildot laukus, man izmet error.html..

 

Bet tas jau neatrisina manu problemu.. nav nekaadu kludas pazinjojumu..

 

Piebildiishu, ka lapa nestav uz localaa servera, es vnk uzraxtiiju script un upload'oju uz bezmaxas serveri, kas atbalsta PHP..

Edited by aywars
Link to comment
Share on other sites

Serveris ir pandela.com.

 

Esmu paris reizes raxtiijis, tachu atbildi nesanjeemu..

Ir noradiits, ka serveris atbalsta php 5. Tagad, spriezhot peec servera info, vinjiem uzlikta 5.1.1 versija.

Veel servera info noradiiti "path uz perl", "path uz sendmail", veel noradiits, ka darbojas kaut kaads qmail (tjip up and running).. man par to nav lielas saprashas..

Vai tiesham var taa buut, ka serveris atbalsta PHP, tachu neatbalsta mailu suutishanu ar PHP scriptu?

Mosh jauzraxta cgi scripts, kur noradiiti tie path? Bet nez vai man izdosies,ko taadu izdariit, ja vien man kaads nepaliidzees.. :(

Link to comment
Share on other sites

Nosuutiju jautajumu uz pandela.com caur control paneli, un shoreiz sanjemu atbildi..

 

We do support php mail and smtp. To be able to send mail you must have a domain name. You have to add a mailbox through our control panel so you can use our mail services. The only restriction we have concerns the amount of the e-mails - you can send up to 20 mails per hour. And have in mind that when you send e-mails through your account, they have to be sent with From: header set to your valid mailbox.

 

Best Regards,

Pandela.com Support Team

 

Tagad viss skaidrs. Man nav domain name, ir tikai subdomain.. Paldies visiem par megjinajumu palidzet!

Link to comment
Share on other sites

×
×
  • Create New...