KMail v2.0


KMail class is for sending mail via smpt with utf-8, inline pictures and attachments support.
If You found a bug, You can send mail to kami.eper@gmail.com.

KMail public functions:
new KMail();initialize the class
host($host);define smtp host
port($int);define port to connect (default: 25)
secure($ssl);define secure connection type (default: none)
limit($int);smtp maximum recipients in one session, default 50
user($username);define username to connect
password($password);define password to connect
mail_list();add header send mail To: Undisclosed recipients senders@mail and add list_id and list unsubscribe headers
(without mail_list mode the list_id and unsubscribe will be ignored)
list_id($string);send list id header in mail_list mode
unsubscribe();sends unsubscribe header in mail_list mode, usage: unsubscribe($mailaddress, optionally $url)
from($mail);define senders mail
sender_name($name);define senders name to show
reply($mail);define reply to (default: no-reply), if mail is not defined reply to sender
to();define recipents (one or more in array or comma+whitespace separated list)
cc();define recipents of carbon copies (one or more in array or comma+space separated list)
bcc();define recipents of blind carbon copies (one or more in array or comma+space separated list)
subject($subject);define mails subject
message($message);define message
message_from_file($file);define the file contains the message (if message is defined from file the message(str) will be ignored)
txt();send mail as text/plain (default: html)
embedd_pics();define inline pictures for html files (one or more in array or comma separated list)
the filename in html img src="" part must appear in embedd_pics list or will be ignored (send without)
LIMITATIONS:
1. file and directory names cannot contains comma
2. cannot use same filename with different path more times (will send only first picture for all)
attach($string or $array);define attachment(one or more)
send();mail send (returns TRUE if mail is sended for one recipients)
report();report warnings and errors
debug();show sended commands and responses for debug


KMail requirements & limitations:
PHP 4 >= 4.2.0, mbstring extension.
KMail will send messages how was get, with magic quotes enabled the strings must to be stripped (stripslashes) before sending.


Example KMail call file
<?php
	include_once ('includes/KMail.class.php');
	$mail=new KMail();
		//$mail->debug();
		$mail->host('yourhost');
		$mail->port(25);
		$mail->secure('ssl');
		$mail->user('username');
		$mail->limit(20);
		$mail->password('password');
		$mail->sender_name('sender');
		$mail->from('from@mail.com');
		$mail->reply();
		//$mail->mail_list();
		//$mail->list_id('maillist');
		//$mail->unsubscribe('unsubscribe@mail.com');
		$mail->to('to@mail.com');
		//$mail->bcc('mail2k@mail.com, mail3k@mail.com');
		//$mail->cc(array('mail4k@mail.com', 'mail5k@mail.com'));
		$mail->subject('subject');
		//$mail->message('message');
		$mail->message_from_file('mail.html');
		$mail->embedd_pics('picture1.png, picture2.jpg');
		//$mail->txt();
		$mail->attach('attachment1.html, attachment2.pdf');
		if (! $mail->send()) echo 'Error...';
		echo $mail->report();

?>