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
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><?php require_once("config.inc.php"); //--------------------------------------------------------------------------------------------------------------------------------------------------- $link = mysql_connect($cfgServers['host'],$cfgServers['stduser'],$cfgServers['stdpass'])or die("Can't connect Server"); mysql_select_db($cfgServers['selectdb']) or die("Can't connect databases");
require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.psucoop-home.com"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "mailsender@psucoop-home.com"; // SMTP username $mail->Password = "12345678"; // SMTP password $mail->From = "psucoop@psucoop-home.com"; $mail->FromName = "psucoop-home.com";
$query="SELECT email FROM tbl_maillist ORDER BY email ASC "; $resultmail=mysql_query($query); while($data=mysql_fetch_assoc($resultmail)){ $mail->AddAddress($data['email']); $mail->AddReplyTo("psucoop@psucoop-home.com", "psucoop-home.com"); $mail->WordWrap = 200; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = "http://www.psucoop-home.com"; $mail->Body=$_POST['topic']."<br>".$_POST['detail']."" ." <br>ทีมงานบริหารเว็บไซต์ <br>" ."<a href='http://www.psucoop-home.com'>http://www.psucoop-home.com</a>"; if(!$mail->Send()) { print("".$mail->ErorInfo); } else { ?> <script language="javascript"> alert('ส่งเมล์ถึงผุู้รับแล้วครับ'); window.location.href='main.php'; </script> <!-- print("ส่งเมล์ถึงผุู้รับแล้วครับ"); --> <!--print $textMessage; --> <?php } } ?>
|