aywars Posted October 17, 2006 Report Share Posted October 17, 2006 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 More sharing options...
v3rb0 Posted October 17, 2006 Report Share Posted October 17, 2006 nu tas header("Location: message_sent.html"); tak vienmēr teiks ka nosūtīts. novāc to '@' pirms mail() un ieliec if'ā if(mail()) { // aizsūtīja } else { // nevella neaizsūtīja } Link to comment Share on other sites More sharing options...
andrisp Posted October 17, 2006 Report Share Posted October 17, 2006 Tik atceries: Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. Link to comment Share on other sites More sharing options...
aywars Posted October 17, 2006 Author Report Share Posted October 17, 2006 v3rb0 - tu domaji taa (?) : if(mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header )) { // aizsūtīja } else { // nevella neaizsūtīja } Link to comment Share on other sites More sharing options...
andrisp Posted October 17, 2006 Report Share Posted October 17, 2006 Nu ja, ka viņš tā domāja :). Bet to @ varēji nenovākt. http://lv2.php.net/manual/en/language.oper...rrorcontrol.php. if () {} konstrukcija tāpat strādās. Link to comment Share on other sites More sharing options...
aywars Posted October 17, 2006 Author Report Share Posted October 17, 2006 (edited) 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 October 17, 2006 by aywars Link to comment Share on other sites More sharing options...
andrisp Posted October 17, 2006 Report Share Posted October 17, 2006 Nu tad iespējams, ka tas serveris nemaz neatbalsta meilu sūtīšanu. Paskaties vai viņiem nav kautkāds help vai faq, vai arī sazinies ar viņiem un uzjautā. Link to comment Share on other sites More sharing options...
aywars Posted October 17, 2006 Author Report Share Posted October 17, 2006 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 More sharing options...
andrisp Posted October 17, 2006 Report Share Posted October 17, 2006 Nu tas, ka ir PHP nenozīmē, ka uzreiz var arī meilus sūtīt. Link to comment Share on other sites More sharing options...
kerz Posted October 17, 2006 Report Share Posted October 17, 2006 bet serveris vispaar atbalsta mail funkciju? Link to comment Share on other sites More sharing options...
Orion7 Posted October 17, 2006 Report Share Posted October 17, 2006 Jā, atbalsta: C:\>nslookup -type=MX pandela.com Server: *** Address: *** Non-authoritative answer: pandela.com MX preference = 10, mail exchanger = mail2.pandela.com E-pasta serveris ir mail2.pandela.com Link to comment Share on other sites More sharing options...
andrisp Posted October 17, 2006 Report Share Posted October 17, 2006 Manuprāt, tas jau arī nenozīmē, ka php atbalsta meilu sūtīšanu. Link to comment Share on other sites More sharing options...
aywars Posted October 17, 2006 Author Report Share Posted October 17, 2006 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 More sharing options...
Recommended Posts