email (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> email (4/20/2005 9:58:19)

Hi, I need an example of asp code how to send email with attach file from the web site to the server
Thanks, Elen




wizard_oz -> RE: email (4/20/2005 11:36:19)

I have a code that doesn't work can anyone help me?
<%
	sub sendMail(fromWho,toWho,subject,body)
		dim myMail
		SET myMail=server.CreateObject("CDONTS.Newmail")
		
		myMail.From=fromWho
		myMail.TO=toWho
		myMail.Subject=Subject
		myMail.Body=Body
		myMail.Send
		SET myMail=nothing
	end sub
	
	fromWho=TRIM( Request.Form("fromWho"))
	toWho=TRIM( Request.Form("toWho"))
	Subject=TRIM( Request.Form("Subject"))
	Body=TRIM( Request.Form("body"))
	if toWho<>"" then
		sendMail fromWho,toWho,Subject,body
	end if
%>
<FORM method="POST" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<br>TO:<INPUT type="text" name="toWho" size=40>
<br>FROM:<INPUT type="text" name="fromWho" size=40>
<br>SUBJECT:<INPUT type="text" name="subject" size=40>
<br><TEXTAREA rows=5 cols=40 id=textarea1 name=body></TEXTAREA>
<BR><INPUT type="submit" value="Send Mail" id=submit1 name=submit1>
</FORM>




BeTheBall -> RE: email (4/20/2005 13:24:22)

I thought you said you needed to include an attachment? The code above has no section for attachments. Do you need to include an attachment or did you misspeak?




Spooky -> RE: email (4/20/2005 15:44:24)

Youll attach like so :
<%
	sub sendMail(fromWho,toWho,subject,body)
		dim myMail
		SET myMail=server.CreateObject("CDONTS.Newmail")
		
		myMail.From=fromWho
		myMail.TO=toWho
		myMail.Subject=Subject
		myMail.Body=Body
myMail.AttachFile "c:\inetpub\wwwroot\filename.zip"
		myMail.Send
		SET myMail=nothing
	end sub
	
	fromWho=TRIM( Request.Form("fromWho"))
	toWho=TRIM( Request.Form("toWho"))
	Subject=TRIM( Request.Form("Subject"))
	Body=TRIM( Request.Form("body"))
	if toWho<>"" then
		sendMail fromWho,toWho,Subject,body
	end if
%>





wizard_oz -> RE: email (4/21/2005 1:58:27)

This is my first time creating the email application,what should I write in the fromWho? is this the person who look at the web site?
What should I put in toWho? is this me? and if so, what should I put there?
At the above code I tryied to create a form but it doesn't work, can you explain to me why?




Spooky -> RE: email (4/21/2005 3:42:10)

The first thing to try - would be to see if the form works.
Use your own email address in moth boxes.

Does the mail arrive or is an error created?




wizard_oz -> RE: email (4/21/2005 4:06:55)

at my code I input my email and I got en error messege in line 4




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625