Current location: Hot Scripts Forums » Programming Languages » ASP » Simple Email from to email!


Simple Email from to email!

Reply
  #1 (permalink)  
Old 05-18-05, 08:27 AM
AskAR AskAR is offline
Newbie Coder
 
Join Date: May 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Simple Email from to email!

Hi,

I have below code for sending an email from the form with an attachement. Its all work fine. But I have two field in form: Name, Email. I want these both field will be add in the email sent out.
----------------------------------------------
<%@ Language=VBScript %>
<%Option Explicit%>
<!-- #include file="upload.asp" -->
<!--#include file="cdovbs.inc" -->
<%
' Create the FileUploader
Dim Uploader, File
Set Uploader = New FileUploader

' This starts the upload process
Uploader.Upload()

' Loop through the uploaded files
For Each File In Uploader.Files.Items

' Save the file to a directory of your server
File.SaveToDisk Server.MapPath("/tst-em-form-upload/")

Next
Dim objMail,strWho,strTo,strFrom,strCC
strWho = Uploader.form("name")
strTo = "MyEmail@MyDomain.com"
strCC=""
strFrom = Request.ServerVariables("SERVER_NAME")
Set objMail = CreateObject("CDONTS.NewMail")
objMail.From = strFrom
objMail.To = strTo
objMail.Cc=strCC
objMail.Subject = "Email Subject!"
objMail.Body = "Email Text Body"
objMail.importance = cdoHigh
objMail.MailFormat = 0
For Each File In Uploader.Files.Items
objMail.AttachFile Server.MapPath("/tst-em-form-upload/"& File.FileName)
Next
objMail.Send
Set objMail = nothing

%>
----------------------------------------------


Cam any one help?


Thanks,
Raza
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-18-05, 10:16 AM
koncept
Guest
 
Posts: n/a
objMail.Body = "Email Text Body"
change that line to be

objMail.Body = Request.form("name") & " - " & request.form("email")

should do it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-18-05, 10:27 AM
AskAR AskAR is offline
Newbie Coder
 
Join Date: May 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by koncept
objMail.Body = "Email Text Body"
change that line to be

objMail.Body = Request.form("name") & " - " & request.form("email")

should do it

It is now workig by above. I put below then its work.
objMail.Body = Uploader.form("name") & " - " & Uploader.form("email")

But issue is now I want to make it some HTML like:
Name: name
Email: email

Is it posible?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-18-05, 10:35 AM
koncept
Guest
 
Posts: n/a
Quote:
Originally Posted by AskAR
It is now workig by above. I put below then its work.
objMail.Body = Uploader.form("name") & " - " & Uploader.form("email")

But issue is now I want to make it some HTML like:
Name: name
Email: email

Is it posible?
objMail.Body = "<b>Name: </b>" & Uploader.form("name") & "<br><b>Email: </b>" & Uploader.form("email")

make sure these two lines are in there as well
objMail.BodyFormat=0
objMail.MailFormat=0
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-18-05, 12:31 PM
AskAR AskAR is offline
Newbie Coder
 
Join Date: May 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by koncept
objMail.Body = "<b>Name: </b>" & Uploader.form("name") & "<br><b>Email: </b>" & Uploader.form("email")

make sure these two lines are in there as well
objMail.BodyFormat=0
objMail.MailFormat=0
Thank you very much koncept for help.

All is working fine just expect small error. I have date of birth.
DD/MM/YYYY

when I am putting it seprate it is working fine but I wand then togater.
like
DD/MM/YYYY

I am using below and it is giving error.


& "<br><b>Date of Birth: </b>" & Uploader.form("DoBday")/"& Uploader.form("DoBmonth")/"& Uploader.form("DoByear")




Thank you in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 05-18-05, 03:02 PM
koncept
Guest
 
Posts: n/a
its the placement of the / & " marks

& "<br><b>Date of Birth: </b>" & Uploader.form("DoBday")/"& Uploader.form("DoBmonth")/"& Uploader.form("DoByear")

should be
notice the small differences in " "s. its no big deal. when i was learning i did the same thing

& "<br><b>Date of Birth: </b>" & Uploader.form("DoBday") & "/" & Uploader.form("DoBmonth") & "/" & Uploader.form("DoByear")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 05-18-05, 03:09 PM
AskAR AskAR is offline
Newbie Coder
 
Join Date: May 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by koncept
its the placement of the / & " marks

& "<br><b>Date of Birth: </b>" & Uploader.form("DoBday")/"& Uploader.form("DoBmonth")/"& Uploader.form("DoByear")

should be
notice the small differences in " "s. its no big deal. when i was learning i did the same thing

& "<br><b>Date of Birth: </b>" & Uploader.form("DoBday") & "/" & Uploader.form("DoBmonth") & "/" & Uploader.form("DoByear")
Wow... Its working perfectly great.

Thank you very much koncept for such help.

Raza
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 06-27-05, 04:44 PM
dotster dotster is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
for future projects and reference CDOSYS is a great replacement to CDONTS
http://www.powerasp.com/content/new/...ail_cdosys.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Trial of Email Newsletter Campaign findyourhope General Advertisements 0 01-05-05 09:58 PM
Simple internal email server needed for NT 4.0 goanna300 The Lounge 2 10-26-04 03:06 AM
need help to create a attachment on my email frankkk PHP 1 10-25-04 03:10 PM


All times are GMT -5. The time now is 08:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.