php mail function

Gestart doorRubdos10 reacties31 weergaven

11 berichten · pagina 1 van 1

Rubdos

Lid · Topicstarter

Berichten
431
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] mailer [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [URL="http://www.php.net/static"]static[/URL] [COLOR= #007700]function[/COLOR] send[COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$subject[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$message[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR]  [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]X-Mailer: PHP/[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/phpversion"]phpversion[/URL][COLOR= #007700]();[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]To: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$email[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]From: Klikkenpromo <info@klikkenpromo.nl>[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]Reply-To: no-reply@klikkenpromo.nl[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/wordwrap"]wordwrap[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]70[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]@[/COLOR][URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$subject[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$headers[/COLOR][COLOR= #007700]);
    }
}[/COLOR]
?>


wat is er mis mee? mail returned 1, maar hij zend niet confusedHet komt van een o2xs server, iemand ervaring met deze servers?
0
Berichten
1.909
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand iets?
0
Berichten
259
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
moet je eigen email er niet in ?
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij herkent de class mail niet helemaal goed denk ik, omdat mail wordt gezien als functie van php en niet een op zichzelf staande class.wink
0
Berichten
1.909
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Andere suggesties?
(ik bump hem alleen omdat rubdos voor mij een site maakt)
0
Rubdos

Lid · Topicstarter

Berichten
431
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Geen van bovenstaande doet het, heb mail in mailer veranders, nothing happens sadleymail @return true, dus accepted for delivery
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] sendmail [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] verzendmail[COLOR= #007700]([/COLOR][COLOR= #0000BB]$naar[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$onderwerp[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR]  [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]X-Mailer: PHP/[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/phpversion"]phpversion[/URL][COLOR= #007700]();[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]To: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naar[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"n"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]From: Klikkenpromo <info@klikkenpromo.nl>[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"n"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]Reply-To: no-reply@klikkenpromo.nl[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"n"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$go[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$naar[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$onderwerp[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$message[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$headers[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$go[/COLOR][COLOR= #007700]) {[/COLOR]
            [URL="http://www.php.net/return"]return[/URL] true[COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
        }
    }
}[/COLOR]
?>


Probeer deze eens, ff snel gemaakt.
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$headers  = X-Mailer: PHP/ . phpversion();


moet als laatste header wink
0
Rubdos

Lid · Topicstarter

Berichten
431
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daiman schreef:
$headers  = X-Mailer: PHP/ . phpversion();
moet als laatste header wink
Echt? Nice, ffie testen biggrin
BTW:
$headers = X-Mailer: PHP/ . phpversion();
$headers .= To: .$email . "n";

zou als header dit genereren:
X-Mailer: PHP/5.10.0To: blaaat@rommel.prut
ipv
X-Mailer: PHP/5.10.0
To: blaaat@rommel.prut

EDITbiggrinoet het dus ook niet

class mailer {
    public static function send($email, $subject, $message)
    {
        $headers  = From: Klikkenpromo <info@klikkenpromo.nl> . "rn";
        $headers .= Reply-To: no-reply@klikkenpromo.nl . "rn";
        $headers .= X-Mailer: PHP/ . phpversion();
        $message = wordwrap($message, 70);
        return mail($email,$subject,$message,$headers);
    }
}


php.net:
additional_headers (optional)

String to be inserted at the end of the email header.

This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (rn).

Dus @daiman: CRLF, geen LF wink
0
Berichten
1.909
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je error reporting op E_NOTICE zet, wat gebeurt er dan?
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zet "rn" ook na de laatste header?
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren