  | 
              
	              
	                
  
    
	 
        ถามเรื่องการส่งเมล์ด้วย php ไปยัง gmail ครับ ผมส่งเมล์โดยในข้อความมีรูปภาพ ใช้เป็น html ครับ     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ลองใช้ function การส่งด้วย SMTP ของ Gmail ครับ 
 
Code (PHP) 
<?php
	require_once('class.phpmailer.php');
	$mail = new PHPMailer();
	$mail->IsHTML(true);
	$mail->IsSMTP();
	$mail->SMTPAuth = true; // enable SMTP authentication
	$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
	$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
	$mail->Port = 465; // set the SMTP port for the GMAIL server
	$mail->Username = "[email protected]"; // GMAIL username
	$mail->Password = "mypassword"; // GMAIL password
	$mail->From = "[email protected]"; // "[email protected]";
	//$mail->AddReplyTo = "[email protected]"; // Reply
	$mail->FromName = "Mr.Weerachai Nukitram";  // set from Name
	$mail->Subject = "Test sending mail."; 
	$mail->Body = "My Body & <b>My Description</b>";
	$mail->AddAddress("[email protected]", "Mr.Adisorn Boonsong"); // to Address
	$mail->AddAttachment("thaicreate/myfile.zip");
	$mail->AddAttachment("thaicreate/myfile2.zip");
	//$mail->AddCC("[email protected]", "Mr.Member ThaiCreate"); //CC
	//$mail->AddBCC("[email protected]", "Mr.Member ThaiCreate"); //CC
	$mail->set('X-Priority', '1'); //Priority 1 = High, 3 = Normal, 5 = low
	$mail->Send(); 
?>
                        
               
               | 
             
            
              
			  			  
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2010-05-03 21:37:45 | 
                        By :
                            webmaster | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมลองทำตามแล้วเวลารันปรากฏว่ามันทำรอบละ 3 ครั้งคือ รันครั้งเดียวแต่ส่งมา 3 เมล์                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-10-14 17:18:46 | 
                        By :
                            treza | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ไม่เกี่ยวกับ code ตัวนี้ครับ                          
               
               | 
             
            
              
			  			  
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-10-14 17:34:15 | 
                        By :
                            webmaster | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |