-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail.php
More file actions
59 lines (49 loc) · 1.88 KB
/
email.php
File metadata and controls
59 lines (49 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require 'libs/PHPMailer/PHPMailerAutoload.php';
function mail_only($mailto, $mailcc, $from_mail, $from_name, $replyto, $subject, $message) {
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
// $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom($from_mail, $from_name);
$mail->addAddress($mailto); // Add a recipient
$mail->addReplyTo($replyto);
$mail->addCC($mailcc);
$mail->isHTML(false); // NOT HTML
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->send()) {
return false;
} else {
return true;
}
}
function mail_attachment($filename, $path, $dispfilename, $mailto, $mailcc, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
// $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom($from_mail, $from_name);
$mail->addAddress($mailto); // Add a recipient
$mail->addReplyTo($replyto);
$mail->addCC($mailcc);
$mail->addAttachment($file, $dispfilename); // Optional name
$mail->isHTML(false); // NOT HTML
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->send()) {
return false;
} else {
return true;
}
}
?>