User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,515 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,766 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 839 | Replies: 3 | Solved
Reply
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Help Mail Function Problem

  #1  
Sep 30th, 2007
<?php 
$smtp_server = "mail.webhostasp.com"; 
$port = 25; 
$mydomain = "domain.com"; 
$username = "info@domain.com";
$password = "password"; 
$sender = "info@domain.com"; 
$recipient = "no-one@domain.com";
$subject = "Test";
$content = "Bla bla bla";

// SMTP connection 
$handle = fsockopen($smtp_server, $port); 
fputs($handle, "EHLO " . $mydomain . "\r\n"); 

// SMTP authorization 
fputs($handle, "AUTH LOGIN\r\n"); 
fputs($handle, base64_encode($username)."\r\n"); 
fputs($handle, base64_encode($password)."\r\n"); 

// Send out the e-mail 
fputs($handle, "MAIL FROM:<" . $sender . ">\r\n"); 
fputs($handle, "RCPT TO:<" . $recipient . ">\r\n"); 
fputs($handle, "DATA\r\n"); 
fputs($handle, "To: " . $recipient . "\n"); 
fputs($handle, "Subject: " . $subject . "\n\n"); 
fputs($handle, $content . "\r\n"); 
fputs($handle, ".\r\n"); 

// Close connection to SMTP server 
fputs($handle, "QUIT\r\n"); 
?>

this code works only once, then dos NOT work anymore on my server.
anyone has idea??
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Mail Function Problem

  #2  
Sep 30th, 2007
i have had problems before where if i didn't close the connection it wouldn't work again. maybe adding "fclose($handle);" will help.
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: Mail Function Problem

  #3  
Sep 30th, 2007
i tried but no success...
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: Mail Function Problem

  #4  
Sep 30th, 2007
anyway.. i solved the problem.. if you need the codes supported with attachments send me pm...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC