Kod: Markera allt
554 5.0.0 /etc/mail/sendmail.cf: line 162: unknown configuration line "BS smtp.bredband.net"
Kod: Markera allt
554 5.0.0 /etc/mail/sendmail.cf: line 162: unknown configuration line "BS smtp.bredband.net"
Kod: Markera allt
<?
error_reporting(E_ALL);
ini_set("display_errors","1");
$catre = "vem ska mailet skickas till?";
$subject = "vad är mailets titel?";
$message = "vad som ska stå i mailet";
$headers = "";
$from = "vem mailet skickas ifrån";
$body = "none";
function sock_mail($to,$subj,$body,$head,$from){
$lb="\r\n"; //linebreak
$body_lb="\r\n"; //body linebreak
$loc_host = "localhost"; //localhost
$smtp_host="smtp.bredband.net"; //server SMTP
$hdr = explode($lb,$head); //header
if($body) {$bdy = preg_replace("/^\./","..",explode($body_lb,$body));}
$smtp = array(
// call the server and tell the name of your local host
array("HELO ".$loc_host.$lb,"220,250","HELO error: "));
// envelop
$smtp[] = array("MAIL FROM: <".$from.">".$lb,"250","MAIL FROM error: ");
$smtp[] = array("RCPT TO: <".$to.">".$lb,"250","RCPT TO error: ");
// begin data
$smtp[] = array("DATA".$lb,"354","DATA error: ");
// header
$smtp[] = array("Subject: ".$subj.$lb,"","");
$smtp[] = array("To:".$to.$lb,"","");
foreach($hdr as $h) {$smtp[] = array($h.$lb,"","");}
// end header, begin the body
$smtp[] = array($lb,"","");
if($bdy) {foreach($bdy as $b) {$smtp[] = array($b.$body_lb,"","");}}
// end of message
$smtp[] = array(".".$lb,"250","DATA(end)error: ");
$smtp[] = array("QUIT".$lb,"221","QUIT error: ");
// open socket
$fp = @fsockopen($smtp_host, 25);
if (!$fp) echo "<b>Error:</b> Cannot conect to ".$smtp_host."<br>";
$banner = @fgets($fp, 1024);
// perform the SMTP dialog with all lines of the list
foreach($smtp as $req){
$r = $req[0];
// send request
@fputs($fp, $req[0]);
// get available server messages and stop on errors
if($req[1]){
while($result = @fgets($fp, 1024)){if(substr($result,3,1) == " ") { break; }};
if (!strstr($req[1],substr($result,0,3))) echo"$req[2].$result<br>";
}
}
$result = @fgets($fp, 1024);
// close socket
@fclose($fp);
return 1;
}
sock_mail($catre,$subject,$message,$headers,$from);
?>
Min lösning detJoeLowE skrev:Detta inlägg fixade mitt problem
http://phpportalen.net/viewtopic.php?t=53600