BhA Posted August 3, 2007 Share Posted August 3, 2007 Hi guys, I was working on writing a little application for my firm and I got stuck at my final module that has to mail some information to our employees through the Exchange Server. Seems like everything is working perfectly fine except the mailing part. I used to use regular mail function but it didn't worked in this scenario. I am using WinBinder to compile the php code. But I couldn't figure out whether the problem is sourced from my code, from the WinBinder libraries, or from the exchange server. I spent my whole day researching about different mailing methods. But I simply couldn't managed to send the mail. (Exchange Server has its own box not on the localhost). Here is the part of the code I'm stucked at: case ID_VACATION: //VACATION - TIME CONTROLLER require("C:\WinBinder\phpcode\include\phpmailer\class.phpmailer.php"); $db = odbc_connect("resumelink","",""); if ( $db != FALSE) { wb_message_box($window, "Sending Emails to the employees... \n"); } else { wb_message_box($window, "Connection failed to the database."); } $result = odbc_exec($db, "SELECT email, vactime FROM vac_time"); while ($row = odbc_fetch_array($result)) { $vacation = $row["vactime"]; $email = $row["email"]; // wb_message_box($window, "$email"); //value control // wb_message_box($window, "$vacation"); //value control $mail = new PHPMailer(); $mail->From = "admin@companyname.com"; $mail->FromName = "Business Unit"; $mail->Host = "companysmtpaddress"; $mail->Username = "username"; $mail->Password = "password"; $mail->Mailer = "smtp"; $text_body = "Hello, \n\n"; $text_body .= "You have $vacation hours of vacation time.\n\n"; $text_body .= "Sincerely, \n"; $mail->Body = $text_body; $mail->AddAddress($email); if(!$mail->Send()){ wb_message_box($window, "There has been a mail error sending to $email");} else{ wb_message_box($window, "Mail sent to $email"); } } break; Now some of you might say why don't you go post this over to WinBinder forums. But as far as I know this board is much helpful than the rest of the php forums and I hope someone can guide me through this problem. PS: I edited the smtp section of php.ini already and restarted my web services didn't helped. Quote Link to comment https://forums.phpfreaks.com/topic/63236-solved-mailing-through-exchange-server/ Share on other sites More sharing options...
BhA Posted August 3, 2007 Author Share Posted August 3, 2007 ok problem solved. I hate finding the solutions after searching for it whole day and post a help message in the forums The problem was I put the whole address of the smtp server. Changing it to only the computer name that the exchange server resides helped. Well maybe this helps someone. Quote Link to comment https://forums.phpfreaks.com/topic/63236-solved-mailing-through-exchange-server/#findComment-315171 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.