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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><?php include("check_permission.php"); #################################################### if($_POST['action']=='send'){ if(trim($_POST['message']=='')){ ?> <script language="javascript"> alert('กรุณาใส่รายละเอียด'); window.location.href='main.php?work=<?php echo $_GET['work']?>'; </script> <?php }else{ $_POST['topic']=htmlspecialchars( $_POST['topic']); $query="SELECT * FROM tbl_member_data ORDER BY id ASC "; $result=mysql_query($query); require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.bangkokhatyai.com"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "mailserv@bangkokhatyai.com"; // SMTP username $mail->Password = "xfd1SYBT"; // SMTP password $mail->From = "mailserv@bangkokhatyai.com"; $mail->FromName = "โรงพยาบาลกรุงเทพหาดใหญ่"; while($email=mysql_fetch_assoc($result)){ $mail->AddAddress($email['email'] , $email['name']." ".$email['sname']); } //$mail->AddAddress("iya555@hotmail.com",'iya'); $mail->AddReplyTo("mailserv@bangkokhatyai.com", "bangkokhatyai newsletter"); $mail->WordWrap = 50; // set word wrap to 50 characters //$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); // set email format to HTML $mail->Subject = "Newsletter"; /* $textMessage="<strong>".$_POST['topic']."</strong>" ."<br><br>" .$_POST['message'] ."<br><br>" ."<hr width='70%' align='left'><br><a href='http://www.bangkokhatyai.com'><img src='http://www.bangkokhatyai.com/th/images/logo.gif' border='0'></a><br><strong>โรงพยาบาลกรุงเทพหาดใหญ่</strong><br> 75 ซอย 15 ถ.เพชรเกษม ต.หาดใหญ่ อ.หาดใหญ่ จ.สงขลา 90110<br> โทรศัพท์: 0 7427 2800<br> โทรสาร: 0 7427 2840<br> อีเมล์: ContactBhh@bgh.co.th"*/ $_POST['message']=stripslashes ( $_POST['message'] ); $_POST['topic']=stripslashes ( $_POST['topic'] ); $textMessage="<table width='700' border='0' cellspacing='0' cellpadding='10' align='center'> <tr> <td height='65' align='right' bgcolor='#BDD2DB'><h2>NEWSLETTER</h2></td> </tr> <tr> <td align='left' height='30'><strong>".$_POST['topic']."</strong></td> </tr> <tr> <td align='left'>".$_POST['message']."</td> </tr> <tr> <td align='left'> <hr width='700' align='left'><br> <a href='http://www.bangkokhatyai.com'><img src='http://www.bangkokhatyai.com/th/images/logo.gif' border='0'></a><br> <h5><strong>โรงพยาบาลกรุงเทพหาดใหญ่</strong><br> 75 ซอย 15 ถ.เพชรเกษม ต.หาดใหญ่ อ.หาดใหญ่ จ.สงขลา 90110<br> โทรศัพท์: 0 7427 2800<br> โทรสาร: 0 7427 2840<br> อีเมล์: ContactBhh@bgh.co.th</h5></td> </tr> </table>";
$mail->Body = $textMessage; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } $redirect=1; echo "ข่าวสารได้ถูกส่งออกไปแล้ว"; } }
?> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript"> function checkForm(){ if(document.form1.topic.value==''){ alert('กรุณาใส่หัวข้อ'); return false; }else{ document.form1.action.value='send'; } } </script> </head> <form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" enctype="multipart/form-data" onSubmit="return checkForm()"> <table width="99%" border="0" align="center" cellpadding="2" cellspacing="2"> <tr class="red"> <td width="4%" height="25" align="center" bgcolor="#D9D9B3"><img src="images/black_icon/16x16/app_window.png" width="16" height="16" /></td> <td width="96%" bgcolor="#D9D9B3">ข่าวสารถึงสมาชิก
</td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellpadding="2" cellspacing="2" class="txt10-black"> <tr> <td width="25%" align="right"><input type="hidden" name="action" id="action" /> หัวข้อ</td> <td width="75%"><input name="topic" type="text" id="topic" size="50" maxlength="50" /></td> </tr> <tr> <td align="right">รายละเอียด</td> <td class="red"><textarea name="message" cols="50" rows="5" id="message"></textarea><script language="JavaScript1.2" type="text/javascript">generate_wysiwyg('message'); </script><br /> **การใส่ link url ให้เลือกเมนู create link <img src="links.png" width="25" height="19" />แล้วใส่ url <br /></td> </tr> <tr> <td align="right"> </td> <td><?php if($Permission['permission']==2){?><input type="submit" name="button" id="button" value="ส่งข้อความ" /><?php }?></td> </tr> </table></td> </tr> <tr> <td colspan="2" class="txt10-black"> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </form>
|