Od kilku lat korzystam z poniższego formularza do wysyłania maila ze strony i zawsze odbywało się to bez problemu. Wiadomość ze strony docierała na konto, które miałem na home.pl, potem na kylos.pl, teraz na az.pl czy też gmail.com
Umieściłem formularz na innej stronie gdzie wiadomość ma iść na onet i niestety nie dochodzi. To samo w przypadku podania adresu na interię czy wp.pl (IMG:
http://forum.php.pl/style_emoticons/default/sad.gif)
Czy problem tkwi gdzieś w samym formularzu czy taką regorystyczną politykę antyspamową prowadzą firmy udostępniające darmowe konta pocztowe? - dodam, że wiadomość wysłana ze skryptu nie trafia do spamu. Nie znam się na php na tyle, aby doszukać się tu jakiegoś błędu. Proszę o pomoc.
formularz ma działać na sronce:
http://www.laboratoriumbadawcze.com.pl/kontakt.phpa kod wygląda tak:
<!--c1--><div class='codetop'>KOD</div><div class='codemain'><!--ec1-->
<?
if($s=="1") {
function SendMail($From,$FromName,$To,$ToName,$Subject,$tekst){
$OB="----=_OuterBoundary_000";
$From or
die("<p style="color
:#000000;margin-top:10pt"><strong>Formularz kontaktowy:</strong><br>Brak adresu e-mail"); $To or
die("recipient address missing"); $headers.="MIME-Version: 1.0n";
$headers ="Subject: $Subjectn";
$headers.="From: ".$FromName." <".$From.">n";
$headers.="To: ".$ToName." <".$To.">n";
$headers.="Reply-To: ".$FromName." <".$From.">n";
$headers.="X-Priority: 1n";
$headers.="X-MSMail-Priority: Highn";
$headers.="X-Mailer: My php Mailern";
$headers.="Content-Type: multipart/mixed;ntboundary="".$OB.""n";
//Messages start with text/html alternatives in OB
$Msg.="n--".$OB."n";
$Msg.="Content-Type: text/plain;ntcharset="iso-8859-2"n";
$Msg.="Content-Transfer-Encoding: quoted-printablenn";
// plaintext goes here
$Msg.=$tekst."nn";
// attachments
$Msg.="n--".$OB."--n";
$both=$headers.$Msg;
$fd = @popen("/usr/sbin/sendmail -i -fnull@poczta.onet.pl -t", 'w'); }
function EncodeSubject($subject) {
$subject_length = strlen($subject); $encoded_subject = '=?iso-8859-2?Q?';
if ($subject_length) {
for ($i = 0; $i < $subject_length; $i++) {
$char_code = ord($subject[$i]);
if ($char_code < 0x30
|| ($char_code > 0x39
&& $char_code < 0x41
) || ($char_code > 0x5A
&& $char_code < 0x61
) || $char_code > 0x7A
) $encoded_subject .= '='.bin2hex($subject[$i]); else $encoded_subject .= $subject[$i];
}
}
$encoded_subject .= '?=';
return $encoded_subject;
}
$topic="Laboratorium Badawcze - Będzin";
$topic=EncodeSubject($topic);
$tekst="nnImię i nazwisko: $imie";
$tekst.="nE-mail: $email";
$tekst.="nTresc maila: $tresc";
SendMail($email,$imie,"labbedzin@poczta.onet.pl","Laboratorium Badawcze - Będzin",$topic,$tekst);
echo "<p align=center><font face=Verdana, Arial, size=2 font color=#000000><strong>Dziękujemy. Wiadomość została wysłana. <br>Postaramy się o jak najszybszą odpowiedź.<br><br></p>";
} else {
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' - zły format adresu.n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.n';
} } } else if (test.charAt(0) == 'R') errors += '- wpisz '+nm+'n'; }
} if (errors) alert('Nie wypełniłeś wszystkich pól:n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script><!--c2--></div><!--ec2-->
Ten post edytował tomaszs 5.12.2006, 18:43:16