Tsela ea ho romela mangolo ka lihlooho tse eketsehileng ka PHP

Ho romela melaetsa ka PHP Ho bonolo ebile e lekanyelitsoe


Ho romella melaetsa ka PHP ho bonolo; sohle seo u se hlokang ke mosebetsi le lintlha tse tharo. Hase feela ho na le melaetsa e tloaelehileng ea imeile, leha ho le joalo. Ho shebahala hohle ho feta ho sheba feela ho tla senola hore tšebeliso ena ea email ea PHP ha e na mesebetsi e meng ea motheo. Ka mohlala, ha e behe ho tloha ho: mohlooho oa sehlooho . Tumellanong le botumo ba PHP bakeng sa boiketlo ba tšebeliso, leha ho le joalo, ke phetoho e potlakileng: Etsa feela khang e 'ngoe ho hlalosa lihlooho tse ling tse kang X-Mailer , Cc:, le, ho hlakile, Ho tloha ho:.

Tlhokomeliso: Haeba u totobatsa lihlooho tse fetang tse le 'ngoe, etsa bonnete ba hore o arola mela ea lihlooho ka \ r \ n ho etsa bonnete ba hore ba sebetsa joalokaha ba rerile.

Ho eketsa lihlooho tse ling tse ling tsa PHP

Molaetsa o bonolo o nang le lihlooho tse ling o ka 'na oa shebahala tjena:

$ to = "recipient@example.com";
$ subject = "Bonang!";
$ body = "Hona, \ n \ n U hokae?";
$ headers = "Ho tloha ho: sender@example.com \ r \ n".
"X-Mailer: php";
haeba (mangolo ($,, $ subject, $ body, $ lihlooho)) {
echo ("

Molaetsa o rometsoe! ");
}}
ha ho joalo {
echo ("

ho fana ka molaetsa ho feletsoe ... ");
}}
?>

PHP Imeile ka Lihlooho tse Eketsehileng Ho Sebelisa Mail ea PEAR

U ka boela ua kenya lihlooho tse eketsehileng ha u sebelisa PEAR Mail ho romela imeile, ehlile:

hloka_once "Mail.php";
$ ho = "" Stephanie Sender ";
$ ho = "Richard Mofani ";
$ subject = "Bonang!"; $ xmailer: "php"
$ body = "Hona, \ n \ n U hokae?";
$ host = "ssl: //mail.example.com";
$ port = "465";
$ username = "smtp_username";
$ password = "smtp_password";
$ headers = array ('Ho tloha' = =
$ ho tloha, ho 'ho' =>
$ ho, 'Sehlooho' =>
$ sehlooho, 'X-Mailer' =>
$ xmailer);
$ smtp = Mail :: fektheri ('smtp', sehlopha ('host' =>
$ host, 'port' =>
$ port, 'auth' => e nepahetseng, 'lebitso la username' =>
$ username, 'password' =>
$ password));
$ mail = $ smtp-> romela (
$ ho,
$ lihlooho,
$ mele);
haeba (PEAR :: isError ($ mail)) {
echo ("

" $ $ mail-> getMessage (). "");
}}
ha ho joalo {
echo ("

Molaetsa o rometsoe ka katleho! ");
}}
?>
$ subject = "Bonang!";
$ xmailer: "php"
$ body = "Hona, \ n \ n U hokae?";
$ host = "ssl: //mail.example.com"; $ port = "465";
$ username = "smtp_username";
$ password = "smtp_password";
$ headers = array ('Ho tloha' = =
$ ho tloha, ho 'ho' =>
$ ho, 'Sehlooho' =>
$ sehlooho, 'X-Mailer' => $ xmailer);
$ smtp = Mail :: fektheri ('smtp', sehlopha ('host' =>
$ host, 'port' =>
$ port, 'auth' => e nepahetseng, 'lebitso la username' =>
$ username, 'password' =>
$ password));
$ mail =
$ smtp-> romela ($ ho,
$ lihlooho,
$ mele);
haeba (PEAR :: isError ($ mail)) {
echo ("

".
$ mail-> getMessage (). "");
}}
ho seng joalo {e ("

Molaetsa o atetsoe ka katleho! ");
}}
?>