Another way to send mail without mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Another way to send mail without mail()

Post by Milan »

I found this online i tought it would be nice to share with you guys, i tried it and it works great.

Code: Select all

<?
    $message=new COM('CDO.Message');
    $messageCon=new COM('CDO.Configuration');
    $messageCon->Fields['http://schemas.microsoft.com/cdo/configuration/smtpserver']- >value='mail-v.SMTP.com';
    $messageCon->Fields['http://schemas.microsoft.com/cdo/configuration/smtpserverport']- >value=25;
    $messageCon->Fields['http://schemas.microsoft.com/cdo/configuration/sendusing']->value=2;
    $messageCon->Fields[' http://schemas.microsoft.com/cdo/config ... ontimeout']->value=60;
    $messageCon->Fields->Update();
    $message->Configuration = $messageCon;
    $message->To = "milan@mel.com";
    $message->From = "verificator@me.com";
    $message->Subject = "Hello";
    $message->HTMLBody = "Insert <b>Message</b>";
    $message->Send() ;
    ?>
Last edited by Milan on Mon May 29, 2006 4:23 pm, edited 2 times in total.
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Post by ianhull »

Does the server it is running on need to have CDonts installed?

Thanks
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

not sure

Post by Milan »

not sure but i tried it on fresh installation of windows 2000 server with IIS6 and it worked flawless
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Post by ianhull »

Well CDonts will not be installed with that installation so thats great.

Thanks for sharing
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

FYI ~Milan - you've got an extra space in the line that sets the connection timeout.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply