Problem med PHP & SMTP mail
jag har ett foto galleri i PHP, & det är så att jag vill kunna låta mina besökare registrera sig för att komma åt andra mer privata gallerier...
problemet är att galleriet bara stödjer att verifierings mailen skickas med egen webserver....
men då hitta jag en bit PHP code till det galleriet som gör att man kan använda sin SMTP adress för att skicka mailen istället....
problemet är att jag får upp det här felmedelandet varje gång jag jag försöker att prova att registrera ett nytt konto i galleriet
Create User for Gallery.
MAIL FROM error: .530 authentication required - for help go to http://help.yahoo.com/help/us/sbc/dsl/m ... op-11.html
RCPT TO error: .
DATA error: .
DATA(end)error: .
QUIT error: .
An email has been sent to totaltslutihuvet@hotmail.com.
Your account information is contained within the email.
& eftersom att jag får samma felmedelande(530 authentication required ) i outlook express när jag inte har "SMTP Servern kräver autentisering" ibockat så antar jag att det beror på nått med det....
vad jag kan se i coden så verkar det som att den försöker autentisera
men eftersom jag inte är någon kung på PHP direkt så är jag inte säker...
så jag vore väldigt tacksam om nån har nån ide om vad som kan vara fel....
code snutten jag använder är den som följer...
function sock_mail($auth,$to, $subj, $body, $head, $from){
$lb="\r\n"; //linebreak
$body_lb="\r\n"; //body linebreak
$loc_host = "localhost"; //localhost
$smtp_acc = "tresk@sbcglobal.net"; //account
$smtp_pass="**********"; //password
$smtp_host="smtp.sbcglobal.yahoo.com"; //server SMTP
$hdr = explode($lb,$head); //header
if($body) {$bdy = preg_replace("/^\./","..",explode($body_lb,$body));}
// build the array for the SMTP dialog. Line content is array(command, success code, additonal error message)
if($auth == 1){// SMTP authentication methode AUTH LOGIN, use extended HELO "EHLO"
$smtp = array(
// call the server and tell the name of your local host
array("EHLO ".$loc_host.$lb,"220,250","HELO error: "),
// request to auth
array("AUTH LOGIN".$lb,"334","AUTH error:"),
// username
array(base64_encode($smtp_acc).$lb,"334","AUTHENTIFICATION error : "),
// password
array(base64_encode($smtp_pass).$lb,"235","AUTHENTIFICATION error : "));
}
else {// no authentication, use standard HELO
$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;
}
i spilt some stain remover on my sleeve. How do you get that out?