Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

How send email web page asp

How send email web page asp
0
toeban
Asked:
toeban
3 Solutions
 
SplatCommented:
I'm assuming that you are trying to send a HTML email uisng ASP...?

If so, this should work...

<%
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
    objCDO.MailFormat = 0  'tells it to be HTML
    objCDO.BodyFormat = 0  'tells it to be HTML
    objCDO.From = "your.address@domain.com"
    objCDO.value("Reply-To") = "your.address@domain.com"  'reply address
    objCDO.To = "address@domain.com"
    objCDO.CC = "address@domain.com"
    objCDO.BCC = "address@domain.com"
    objCDO.Subject = "This is a HTML email"
    objCDO.Body = "This is the body"
    objCDO.Send
Set objCDO = Nothing  'cleanup
%>

You can remove the Reply-To, CC, and BCC lines if you like.

0
 
Dean OBrienCommented:
I tried using the above code, but to no joy!  Is there anything other than ASP, that needs to be supported on the server?

  i.e  'Server.CreateObject("CDONTS.NewMail")'

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SplatCommented:
The M$ CDONTS component does need to be installed on the server.  I'm not the admin for the servers that I use, so I'm not too sure how to install this component, but you can find out more information regarding CDONTS at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_denali_installing_cdo_for_nts.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_denali_cdo_for_nts_library.asp

0
 
BubbaisBestCommented:
If your server has ASPMail installed here is the code for it.  I actually read from a form to send this HTML email message.  You can edit it as needed:

  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
   
  strFirstName = Request.Form("first_name")
  strLastName = Request.Form("last_name")
  strSenderName = strFirstName & " " & strLastName
  strAddress = Request.Form("address")
  strCityState = Request.Form("city_state_zip")
  strEmailAddress = Request.Form("email")
  strProblemType = Request.Form("problem")
  strComment = Request.Form("comments")

  HTML = HTML & "<html>"
  HTML = HTML & "<head>"
  HTML = HTML & "<title>Your Page Title Here</title>"
  HTML = HTML & "</head>"
  HTML = HTML & "<body>"
  HTML = HTML & "From: " & strSenderName & "<br />"
  HTML = HTML & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " & strAddress & "<br />"
  HTML = HTML & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " & strCityState & "<br />"    
  HTML = HTML & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " & strProblemType & "<br />"    
  HTML = HTML & "<br /><br /><br />" & strComment
  HTML = HTML & "</body>"
  HTML = HTML & "</html>"
 
  Mailer.FromName = strSenderName
  Mailer.FromAddress = strEmailAddress
  Mailer.RemoteHost = "mail.mymailserver.com" ' change to your smtp mail server
  Mailer.AddRecipient "Where to send email name", "email address"
  Mailer.Subject = "Your Subject Here"
  Mailer.ContentType = "text/html"
  Mailer.BodyText = HTML

Shayne
0
 
Ice69devilCommented:
hi toeban,
SPLAT's method using the CDONTS.NewMail object should work...i have created another similar one in another thread perhaps u can try as well....
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20541877.html

Cheers

IcE
0
 
sreekanth_k77Commented:
<% dim fromadd,toadd,sub,body,cls
fromadd=Request.Form("text1")
toadd=Request.Form("text2")
sub=Request.Form("text3")
body=Request.Form("TEXTAREA1")
set cls=Server.CreateObject("cdonts.newmail")
cls.From=fromadd
cls.To=toadd
cls.Subject=sub
cls.Body=body
cls.Send
Response.Write "Your mail is send to " & t%>
0
 
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
Programming_GalCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between Splat, whammy, BubbaisBest

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Programming_Gal
EE Cleanup Volunteer
0
 
whammyCommented:
Sounds good to me, they all have pretty much the same answers, and the 4guysfromrolla.com link that I gave has additional info as well on many other email components besides CDONTS.

I figured if Splat's solution didn't work, then at least one of the components in the link I posted should be installed on ANY ASP server. Apparently that's the same angle Bubba was taking with his ASPMail post, so his response is definitely valid.

You must really know your stuff, Programming_Gal, to come up with that solution for splitting points!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now