Mail

from($from = ”)

100: 	function from($from = '') {
101: 		$this->from = $from;
102: 	}

File: lib/support/Mail.php, #line 100

to($to = ”)

107: 	function to($to = '') {
108: 		if (!is_array($this->to)) {
109: 			$this->to = array ();
110: 		}
111: 		$this->to[] = $to;
112: 	}

File: lib/support/Mail.php, #line 107

html($html)

117: 	function html($html) {
118: 		$this->html = $html;
119: 	}

File: lib/support/Mail.php, #line 117

body($body)

124: 	function body($body) {
125: 		$this->body = $body;
126: 	}

File: lib/support/Mail.php, #line 124

plain($plain)

131: 	function plain($plain) {
132: 		$this->plain = $plain;
133: 	}

File: lib/support/Mail.php, #line 131

subject($subject)

138: 	function subject($subject) {
139: 		$this->subject = $subject;
140: 	}

File: lib/support/Mail.php, #line 138

attachment($file = ”)

145: 	function attachment($file = '') {
146: 		$this->attachments[] = $file;
147: 		$this->attach = true;
148: 	}

File: lib/support/Mail.php, #line 145

send()

153: 	function send() {
154: 		global $Logger;
155: 		$tos = '';
156: 		$message = '';
157:
158: 		$this->smtp_connect();
159: 		$this->smtp_send_info("HELO " . $this->localhost);
160:
161: 		if ($this->ttl) {
162: 			$this->smtp_send_info("STARTTLS");
163: 			$this->smtp_send_info("HELO ");
164: 		}
165:
166: 		if ($this->auth) {
167: 			$this->smtp_send_info("AUTH LOGIN");
168: 			$this->smtp_send_info(base64_encode($this->user));
169: 			$this->smtp_send_info(base64_encode($this->password));
170: 		}
171:
172: 		$this->smtp_send_info("MAIL FROM: " . $this->from);
173:
174: 		foreach ($this->to as $to) {
175: 			$tos = empty ($tos) ? $tos = $to : $tos .= ",rnt$to";
176: 			$this->smtp_send_info("RCPT TO: " . $to);
177: 		}
178:
179: 		$this->smtp_send_info("DATA");
180: 		$hash = Md5(Time());
181: 		$this->headers = "MIME-Version: 1.0rn";
182:
183: 		if ($this->attach) {
184: 			$this->headers .= "Content-Type: multipart/mixed; boundary="" . $hash . ""rn";
185: 		}
186:
187: 		if ($this->plain) {
188: 			if (!$this->attach) {
189: 				$this->headers .= "Content-Type: text/plain; charset=iso-8859-1rn";
190: 			}
191: 			$message .= $this->plain;
192: 		}
193: 		elseif ($this->body) {
194: 			if (!$this->attach) {
195: 				$this->headers .= "Content-Type: text/plain; charset=iso-8859-1rn";
196: 			}
197: 			$message .= $this->body;
198: 		}
199: 		elseif ($this->html) {
200: 			if (!$this->attach) {
201: 				$this->headers .= "Content-type: text/html; charset=iso-8859-1rn";
202: 			}
203: 			$message .= $this->html;
204: 		}
205:
206: 		if ($this->attach) {
207:
208: 			$msg = "--" . $hash . "rn";
209: 			$msg .= "Content-Type: text/html; charset=iso-8859-1rn";
210: 			$msg .= "Content-Transfer-Encoding: 7bitrnrn";
211: 			$msg .= $message . "rnrn";
212:
213: 			if (!empty ($this->attachment)) {
214: 				$this->attachments[] = $this->attachment;
215: 			}
216:
217: 			foreach ($this->attachments as $attachment) {
218:
219: 				$msg .= "--" . $hash . "rn";
220:
221: 				$file = fopen($attachment, 'rb');
222: 				$file_content = @ fread($file, filesize($attachment));
223: 				$file_content = @ base64_encode($file_content);
224:
225: 				$file_realname = explode("/", $attachment);
226: 				$file_realname = array_reverse($file_realname);
227: 				$file_realname = $file_realname[0];
228:
229: 				$Bestype = 'application/octet-stream';
231:
232: 				$msg .= "Content-Type: $Bestype; name="" . $file_realname . ""rn";
233: 				$msg .= "Content-Transfer-Encoding: base64rn";
234: 				$msg .= "Content-Disposition: attachment; ";
236: 				$msg .= "filename="" . $file_realname . ""rnrn";
237:
238: 				$file_content = chunk_split($file_content);
239: 				$msg .= $file_content . "rnrn";
240:
241: 			}
242: 			$msg .= "--" . $hash . "--";
243: 			$message = $msg;
244: 		}
245: 		$message = str_replace("n", "rn", $message);
246:
247: 		$this->smtp_send_info("From: $this->fromrnTo: $tosrnSubject: $this->subjectrn$this->headersrnrn$messagern.");
248: 		$this->smtp_send_info("QUIT");
249: 		$this->smtp_disconnect();
250:
251: 		$this->from = '';
252: 		$this->to = '';
253: 		$this->tos = array ();
254: 		$this->body = '';
255: 		$this->html = '';
256: 		$this->plain = '';
257: 		$this->subject = '';
258: 		$this->attachment = '';
259: 		$this->attach = false;
260: 		$this->attachments = array ();
261:
262: 	}

File: lib/support/Mail.php, #line 153

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>