Click to See Complete Forum and Search --> : IIS and Mail Server
ramez_sever
03-21-2003, 07:03 PM
hello guys......
i am using winXP pro and IIS
does IIS support to be mail server so i can send mail or recieve mail.....
if it's not support....how can i make it support
i want to use mail function(php) in my computer(local server)...
how can i do it.....
please help me in this problem....
thanks
jerdo
03-22-2003, 07:29 PM
If you really need a local mail server look into on of the BSDs or Linux, you can get Linux and Free/NetBSD for free and they can run happily on older/cheaper hardware.
ramez_sever
03-22-2003, 07:35 PM
but i am not using linex or unix i am using windows xp pro
jerdo
03-22-2003, 09:05 PM
Then you won't have much luck getting a local mail server, especially a free one.
shoyt
04-21-2003, 03:00 PM
iis comes w/ xp pro, as you know. however, in microsoft's infinite wisdom it has no pop3 or imap functionality...so you can send mail all day long - you just can't log in and get it. i started to program a pop3 service using .net but ran into a fellow who has already done it. i think that it is free at the moment but may later have a small fee for licensing these days (but i doubt it). i've been using it for a year now w/o problems.
the url is: http://www.digitalmapping.sk.ca/pop3srv/default.asp
it allows for account aliasing, etc. and is fairly robust.
as far as using php to send mail through iis...you will have no problems sending mail once you configure the php.ini AS LONG AS your virtual server is set for open relay. i'm getting spam bouncing off my server way too much...not desireable. xp pro doesn't come with cdonts, so the easy work-around is out the window. it does come with cdo 1.2.1 and cdo for windows 2000. you can use the php COM function to create a mail object and go from there. i am currenly trying this but am having problems porting my vb test code to php...i get an error when i send.
the vb test code looks like this:
'requires a reference to cdo for windows 2000 or,
'for scripting languages...use CreateObject("CDO.Message")
Dim cdoMail As CDO.Message
Set cdoMail = New CDO.Message
With cdoMail
Set .Configuration = New CDO.Configuration
With .Configuration.Fields
.Item(cdoSMTPServer) = "127.0.0.1"
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoURLGetLatestVersion) = True
.Item(cdoSendUserName) = "user"
.Item(cdoSendPassword) = "passwd"
.Update
End With
.To = "Sales <sales@renderbar.com>"
.From = "Support <support@renderbar.com>"
.Subject = "Test"
.TextBody = "This is a test of the emergency broadcast system."
.CreateMHTMLBody "http://www.renderbar.com"
.Send
End With
the current php translation is:
<?php
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver";
$cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";
$cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";
$cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername";
$cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword";
$cdoURLGetLatestVersion = "http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion";
$cdoSendUsingPort = 2;
$cdoBasic = 1;
$mail = new COM("CDO.Message");
$mail->Configuration = new COM("CDO.Configuration");
$mail->Configuration->Fields->Item[$cdoSendUsingMethod] = $cdoSendUsingPort;
$mail->Configuration->Fields->Item[$cdoSMTPServer] = "127.0.0.1";
$mail->Configuration->Fields->Item[$cdoSMTPConnectionTimeout] = 10;
$mail->Configuration->Fields->Item[$cdoSMTPAuthenticate] = $cdoBasic;
$mail->Configuration->Fields->Item[$cdoSendUserName] = "user";
$mail->Configuration->Fields->Item[$cdoSendPassword] = "password";
$mail->Configuration->Fields->Item[$cdoURLGetLatestVersion] = True;
$mail->Configuration->Fields->Update;
$mail->To = "sales@renderbar.com";
$mail->From = "RenderBar Imaging";
$mail->Subject = "Test";
$mail->TextBody = "sup dawg!";
$mail->Send;
?>
but, like i said, i've still to work out the kinks in my translation.
hope this helps more that what i've seen in the follow-ups.
steve
ramez_sever
04-21-2003, 05:28 PM
thanks mr.steve........
i download it and i will try it....
but i want to ask you a question.......
can i use the mail function in php.........
or i must use this class?????
thanks again for your help
shoyt
04-21-2003, 05:54 PM
yes you can use the mail function...i should have made that a little more clear. it is how i am currently sending email right now.
the only caveat is that your smtp server must be set up as an open relay. that's why i'm getting so beat up with "spam bounce" activity.
i'm trying to use/create a class that uses cdo for windows 2000 through the php COM functions. the mail function does not provide a means of authentication - hence the open relay delima. cdo for windows 2000 and cdonts do.
here's what i have now:
<?php
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver";
$cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";
$cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";
$cdoURLGetLatestVersion = "http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion";
$cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername";
$cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword";
$cdoSendUsingPort = 2;
$cdoBasic = 1;
$mail = new COM("CDO.Message.1") or die ("Cannot Send Message At This Time");
$mail->Configuration = new COM("CDO.Configuration") or die ("Cannot Send Message At This Time");
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPort;
@$mail->Configuration->Fields[$cdoSMTPServer]->Value = "127.0.0.1";
@$mail->Configuration->Fields[$cdoSMTPConnectionTimeout]->Value = 10;
@$mail->Configuration->Fields[$cdoSMTPAuthenticate]->Value = $cdoBasic;
@$mail->Configuration->Fields[$cdoURLGetLatestVersion]->Value = True;
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPort;
@$mail->Configuration->Fields[$cdoSendUserName]->Value = "user";
@$mail->Configuration->Fields[$cdoSendPassword]->Value = "passwd";
@$mail->Configuration->Fields->Update;
$mail->To = "sales@renderbar.com";
$mail->From = "RenderBar Imaging";
$mail->Subject = "Test";
$mail->TextBody = "sup dawg!";
$mail->Send();
com_release($mail->Configuration);
com_release($mail);
?>
if the @ symbol is absent, you get an error about PropGet() failing. i just read an example using cdont that describes this behavior but that cdonts will still send the message anyway (the @ symbol was their way of not showing the PropGet() error). even so, this still errors out stating that the SendUsing() configuration is invalid. they didn't know what caused the PropGet() error and i'm still looking for the answer as well. i may just give up and defer emailing to an asp page and concede defeat.
hth,
steve
shoyt
04-21-2003, 05:59 PM
crap!
fixed the configuration error! just change this line:
$mail->Configuration->Fields->Update;
to:
$mail->Configuration->Fields->Update();
dang syntax!!!
i'm still getting server availability errors though...i'll let you know what i come up with.
ramez_sever
04-21-2003, 06:30 PM
thanks i will try it and i will let you know if i have some problems
shoyt
04-21-2003, 09:01 PM
when all else fails...KISS.
this works and is much more straightforward. here's a simple test page for you...you may happily close that open relay. this just puts the message directly in the pickup directory w/o the network availability hassle. the only limitation is that the pickup directory must either be on the same pc as the smtp server or shared on your network (use unc notation if that is the case)
<html>
<body>
<?php
function cdoMail($to, $from, $cc, $bcc, $subject, $message){
$cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing";
$cdoSMTPServerPickupDirectory = "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory";
$cdoSendUsingPickup = 1;
$cdoPickupDirectory = "c:\inetpub\mailroot\pickup";
@$mail = new COM("CDO.Message.1");
@$mail->Configuration = new COM("CDO.Configuration");
@$mail->Configuration->Fields[$cdoSendUsingMethod]->Value = $cdoSendUsingPickup;
@$mail->Configuration->Fields[$cdoSMTPServerPickupDirectory]->Value = $cdoPickupDirectory;
@$mail->Configuration->Fields->Update();
@$mail->To = $to;
@$mail->From = $from;
@$mail->CC = $cc;
@$mail->BCC = $bcc;
@$mail->Subject = $subject;
@$mail->TextBody = $message;
@$mail->Send();
com_release($mail->Configuration);
com_release($mail);
}
$to = "recipient@domain";
$from = "sender@domain";
// or like this ...
$to = "It's About Time!!! <recipient@domain>";
$from = "Hey Don't Complain! <sender@domain>";
cdoMail($to, $from, "Test Email Message", "This is a test of the emergency broadcast system");
echo "Message sent successfully!";
?>
</body>
</html>
hope this works for all concerned.
steve hoyt
ramez_sever
04-22-2003, 06:59 AM
it dosn't work.........
maybe i should include a file before is that right??
or may be i didn't configure the server good?
is there some thing i should do before it test the script that you write
shoyt
04-22-2003, 11:38 AM
you need to change the $to and $from portion at the bottom of the script and make sure c:\inetpub\mailroot\pickup is the same folder for your iis pickup directory.
you need to also go to your command prompt and type "netstat -an" and make sure the state of port 25 is "LISTENING". i would also, from the command prompt, telnet into port 25 and manually enter the commands to send and email...tons of examples on the net - or just look at the rfc. this will give you instant feedback on whether you server is configured and running.
another thing to check is to see if your pickup directory has messages waiting after you send/run this test script.
i would suspect it is your server and not the script. i've been "banging" it around enough to satisfy my testing requirements.
good luck.
ramez_sever
04-22-2003, 02:21 PM
can i sned to other domain like me@yahoo.com
or i just can send to accounts in my domain me@localhost
ramez_sever
04-22-2003, 02:27 PM
to=ramez@localhost
from guest@localhost
then i check bad email folder and i see all my tries goes there....
shoyt
04-22-2003, 02:52 PM
you can send an email $to anyone, anywhere. however, you@localhost won't cut it. $from must be a valid account on your system with the fqdn (fully qualified domain name). on my computer i have a user setup as "sales" and my email being sent from the website is sales@renderbar.com...$from = "sales@renderbar.com"
sales won't cut it, sales@localhost won't cut it. make sure $from is equal to a valid system account and that your fqdn is a virtual smtp server name or alias.
my default smtp server account is "mail" and, as standard practice, it has two aliases: "mail.renderbar.com" and "renderbar.com". any of these should work...
sales@mail
sales@mail.renderbar.com
sales@renderbar.com
iis looks up the sales account in the domain and/or its aliases if need be. if it doesn't find the account, it won't send the email...it will move it to the badmail folder.
a little long winded but hopefully gets you going. there is a great explaination of the ins and outs of smtp, including how mx records work and mail routing, on the link i provided in my first post about the free pop3 service.
hth,
steve
ps. you can go to:
http://www.renderbar.com/secure/download.php
and click the "download" button...a link will then appear at the very bottom of the page that says:
"If you need a trial license, please click this link."
click it, input your email address, then click the "email trial license" button. you will get an email that was sent using the exact code i printed in my last post.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.