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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
<!DOCTYPE html> <html> <head> <title>GRID TIP Mass Mailer</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor='#1c7cd6' text='#ffffff'>
<BR><BR><BR><BR>
<?php
$host = "localhost"; // SMTP host $username = "admin.gridtip@gridtip.net"; //SMTP username $password = "mscmks71s11f132n"; // SMTP password
require("class.phpmailer.php");
$uploaddir = 'upload'; $key = 0; $tmp_name = $_FILES["userfile"]["tmp_name"][$key]; $name = $_FILES["userfile"]["name"][$key]; $sendfile = "$uploaddir/$name"; move_uploaded_file($tmp_name, $sendfile); //exit;
$to = $_POST['to']; $addresses = array();
$addresses = explode("\n",$to); //print_r($addresses);exit;
$name = $_POST['who']; $email_subject = $_POST['subject']; $Email_msg = $_POST['message']; $Email_msg2 = str_replace("\n", "<br>", $Email_msg);; //$Email_to = "you@yourSite.com"; // the one that recieves the email $email_from = $_POST['from']; //$dir = "uploads/$filename"; //chmod("uploads",0777); $attachments = array();
//foreach ($addresses as $Email_to) { echo $Email_to."<br>"; } //exit;
foreach ($addresses as $Email_to) {
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP $mail->Host = $host; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = $username; // SMTP username $mail->Password = $password; // SMTP password
$mail->From = $email_from; $mail->FromName = $name; $mail->AddAddress($Email_to); //$mail->AddReplyTo("info@worldtradetown.com","Information"); //foreach($attachments as $key => $value) { //loop the Attachments to be added … //$mail->AddAttachment(”uploads”.”/”.$value); //}
$mail->AddAttachment($sendfile);
$mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML
$mail->Subject = $email_subject; $mail->Body = $Email_msg2; $mail->AltBody = $Email_msg;
if(!$mail->Send()) { echo "<div align='center'><font face='Arial, Helvetica, sans-serif' size='6'>Message was not sent!</font><br>"; echo "<font face='Arial, Helvetica, sans-serif' size='6'>Mailer Error: <b>" . $mail->ErrorInfo; echo "</b></font></div>"; exit; }
echo "<div align='center'><font face='Arial, Helvetica, sans-serif' size='6'><b>Message has been sent to <b><u>$Email_to</u></b></font></div>";
}
?>
</body> </html>
|