Click to See Complete Forum and Search --> : Send email with ASP?


invision
08-10-2007, 04:57 AM
Hello,

I'm trying a little something for the company Intranet and using ASP..unsuccessfully so far.

Just a really basic HTML page :


<form action="V:\contact/contact.asp" method="post">
<p>
<label for="textinput">Name : </label>
<input type="text" id="textinput" name="textinput" class="textinput" maxlength="25" />
</p>
<p> <br />
<label for="label">Your department : </label>
<select size="1" id="select" name="select">
<option selected="selected" value="Test area no.2">Test area no.2</option>
<option value="Another test">Another test</option>
<option value="And another one">And another one</option>
<option value="And yet another one">And yet another one</option>
<option value="One last option for me">One last option for me</option>
</select>
<label for="label2"><br>
Subject : </label>
</p>
<p>
<select size="1" id="mySelect2" name="mySelect2">
<option selected="selected" value="Test area no.2">Test area no.2</option>
<option value="Another test">Another test</option>
<option value="And another one">And another one</option>
<option value="And yet another one">And yet another one</option>
<option value="One last option for me">One last option for me</option>
</select>
</p>
<p>&nbsp;</p>
<p><label for="textareainput">Comments:</label>
<textarea id="textareainput" name="textareainput" class="textarea"></textarea><br />
<input type="submit" value="Submit" class="buttonSubmit" /></p>
<div id="stylesheetTest"></div>
</form>


And need some ASP to send the email. I've tried tutorials on the net, but to no avail. I've also tried coding to


Any pointers?

OctoberWind
08-10-2007, 10:30 AM
first, set all the data you want to send as the body of the email into a variable
(Dim strMsg as String)

set variable: Dim ml
(i forget what this is, but its used in the mail handling below)

<%
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

set ml = server.createObject("CDO.Message")


ml.to = "sentto@email.com"
ml.from = "sendfrom@email.com"
ml.subject = "subject line"
ml.HTMLbody = strMsg
ml.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ml.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.10" ' whatever your SMTP server is
ml.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ml.Configuration.Fields.Update
ml.send
%>

Chikara
08-10-2007, 01:48 PM
Google CDO.Message

nbcrockett
08-11-2007, 08:40 PM
Here's what I use.

<%
Dim objCDO
Dim strFrom
Dim strTo
Dim strMessage

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

strFrom = "address@domain.com"
strTo = "you@domain.com"

strMessage = "This person was just registered.<br>Name - " & Request.Form("txtFirstName") & " " & Request.Form("txtLastName")

objCDO.From = strFrom
objCDO.To = strTo
objCDO.Subject = "New Registration"
objCDO.TextBody = strMessage
objCDO.Send

Set objCDO = Nothing
%>

Check this site out for more examples.
http://www.asp101.com/samples/

This thread might also help.
http://www.webdeveloper.com/forum/showthread.php?t=152994

Search this site for more examples. There are tons of them.