Click to See Complete Forum and Search --> : Formmail question


Extreme
10-01-2003, 09:37 PM
I wish to siwtch from PHP formmailer to ASP but I don't know how.... This is my PHP forma mailer script...

<?
$IP = $HTTP_SERVER_VARS['REMOTE_ADDR'];
mail("myemail0@hotmail.com","Subject",
"
Some text 1: $Variable_1
Some text 2: $Variable_2
IP adress: $IP
");
sleep(3);
header("location: redirect.html");
?>


Now I wish the same script to turn to ASP form mail with SMTP server use.. So, can someone please write me some simple ASP script that will do the same as written above, but will use some external SMTP server and not CDONTS or something like that... Thank you...

Ribeyed
10-02-2003, 02:55 AM
Hi,
before we can give you code you need to tell us what component you are going to use if your not using CDONTS. You said that you are going to use a different SMTP server than CDONTS but CDONTS is not an SMTP server its a component. Did you me you are not going to use IIS's SMTP Server? Again if this is the case and you have disabled IIS's SMTP server then you need to tell us what SMTP server you are going to use.

Bullschmidt
10-02-2003, 08:37 AM
Using the usual CDO:

Email (with Attachment)
http://www.asp101.com/samples/email_attach.asp

Ribeyed
10-02-2003, 11:44 AM
Hi,
you can't use CDO of IIS's SMTP server has been disabled.

Extreme
10-02-2003, 12:20 PM
I just ment to use some extrenal SMTP server like mx1.hotmail.com or smtp1.google.com ..... I don't know if there is local SMTP server installed.. And I don't know much about IIS, so I don't know how to check... Also, íf it is needed, where do I check/install CDONTS component inside IIS?

Ribeyed
10-02-2003, 02:37 PM
Hi,
if you have IIS installed then CDONTS will be there.

Extreme
10-02-2003, 03:05 PM
Do I have to enable this CDONTS, or stup some configuration and where?
Anyway, if everything is automatically seted up, then please write me an ASP script that will proccess the form like I wrote up there...

Ribeyed
10-02-2003, 03:46 PM
<%
sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = Server.CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "<enter_mail.server_here>"
.update
End With

Set cdoMessage = Server.CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "from@me.com"
.To = "to@me.com"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>

Extreme
10-02-2003, 04:07 PM
Thanks, but I still missing few pieces. As you see in my PHP examle, there is $IP variable defined.. YOu didn't define it below and some characters are probably different in ASP, like for examle in PHP variable is written with "$" infront and for ASP it might be different.. Then also, my example $variable1 and $variable2 are not written in example... They should be in text body..
- Next. Is this line needed, and if it is, for what??
sch = "http://schemas.microsoft.com/cdo/configuration/"
- .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
Shouldn't it be 25 instead of 2?
- What are these commands for, and what to write instead of "Nothing"
Set cdoMessage = Nothing
Set cdoConfig = Nothing
- One more thing if you could add on the end
sleep(3);
header("location: redirect.html");
I don't know how to add that myself too or modify it to asp code.. So please if you could write again final code including all my examples..