Form.html:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<form action="SendForm.php" method="post" name="MailForm"> <input name="Nadawca" type="text"> <input name="EMail" type="text">
SendForm.php
<?php
ini_set( 'include_path', '.;lib/pear;../lib/pear' ); /* Twoja Ścieżka do PEAR */
require_once ( 'Mail.php' );
require_once ( 'Mail/mime.php' );
(
'html_charset' => 'ISO-8859-2',
'text_charset' => 'ISO-8859-2',
'head_charset' => 'ISO-8859-2'
);
(
'host' => '<TWOJ_SERWER_POCZTY>',
'auth' => true, /* Jeżeli serwer wymaga autoryzacji wpisujesz true */
'username' => '<TWOJA_NAZWA_UZYTKOWNIKA>',
'password' => '<TWOJE_HASLO>',
);
'<MAIL_ADRESAT>'
);
$objMail = Mail::factory ( 'smtp', $arrSmtpConfig ); $objMime = new Mail_mime ( "rn" );
'From' => $_POST['Nadawca'] . ' <' . $_POST['EMail'] . '>',
'Subject' => '<TEMAT_WIADOMOSCI>'
);
$strTresc = $_POST['Tresc'];
$strHTML = $_POST['Tresc'];
$objMime->setTXTBody ( $strMessage );
$objMime->setHTMLBody ( $strHTML );
$mailBody = $objMime->get ( $arrMailEncoding );
$arrHeaders = $objMime->headers ( $arrHeaders );
if ( PEAR::isError ( $objMail ) )
{
print $objMail->getMessage (); }
else
{
$objError = $objMail->send( $arrRecipients, $arrHeaders, $mailBody );
if ( PEAR::isError ( $objError ) )
{
print $objError->getMessage (); }
else
{
print ( 'Wiadomość została wysłana' ); }
}
?>