Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Help! CDONTS --> ASPMAIL
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Astralis
Senior Member

USA
1218 Posts

Posted - 01 May 2002 :  16:31:43  Show Profile  Send Astralis a Yahoo! Message
If anyone has experience with ASPMail, will you take a look at the following code and convert it? I am having a difficult time with it and for most of you on this board it is probably simple.

1 <%
2
3 ' email values to Set in form
4 ' --------------------------------
5 ' SendersName
6 ' SendersEmail
7 ' EmailSubject
8 ' EmailRecipient
9 ' thanksPage
10
11
12
13
14 ' Set up email values
15 sendersName=request("SendersName")
16 sendersEmail=request("SendersEmail")
17 if sendersName="" then sendersName=sendersEmail
18
19 EmailSubject=request("EmailSubject")
20 if emailSubject="" then emailSubject="Interesting ASP Article"
21
22
23 EmailRecipient=request("EmailRecipient") ' required
24
25 if emailRecipient="" then
26 response.Write("<html><body>Sorry, recipient required!</body></html>")
27 response.End
28 end if
29
30
31
32
33 ' create email
34 Set objNewMail = Server.CreateObject("CDONTS.NewMail")
35
36 objNewMail.From = sendersName & "<" & sendersEmail & ">"
37 objNewMail.Subject = EmailSubject
38 objNewMail.To = EmailRecipient
39 objNewMail.Body = sendersName & " (mailto:" & sendersEmail & ") thought you would be interested in this article " & vbcrlf & vbcrlf & vbcrlf & "Link:" & vbcrlf & request.ServerVariables("HTTP_REFERER")
40
41
42 ' send email
43 objNewMail.Send
44 Set objNewMail = Nothing
45
46
47 ' show thankyou page
48 if not request("thanksPage")="" then
49 response.Redirect(request("thanksPage"))
50 else
51 response.write("<html><body>Message sent.</body></html>")
52 end if
53 response.End
54
55 %>


@tomic
Senior Member

USA
1790 Posts

Posted - 01 May 2002 :  16:54:48  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

Mailer.Timeout = 3600 'Optional
IgnoreMalformedAddress = True 'Optional
IgnoreRecipientErrors = True 'Optional
Mailer.FromName = SendersName
Mailer.FromAddress = SendersEmail
Mailer.AddReplyTo = SendersEmail
Mailer.RemoteHost = "Your Relay goes here!!" 'IMPORTANT
Mailer.AddRecipient EmailRecipient, EmailRecipient 'Need both! Usually name would go first
Mailer.ContentType = "text/html"
Mailer.Subject = EmailSubject
Mailer.BodyText = "<HTML><BODY> " & strMessage & " </BODY></HTML>"
on error resume next '## Ignore Errors
SendOk = Mailer.SendMail
If not(SendOk) <> 0 Then
Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Mailer.Response & "</li>"
End if

Set Mailer = Nothing


In Body text note strMessage. That's where your text would go. I already made a "Send Article to a Friend" if you want a look at it, use it, whatever.

@tomic

http://www.skepticfriends.org

Edited by - @tomic on 01 May 2002 16:55:47
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 01 May 2002 :  17:15:52  Show Profile  Send Astralis a Yahoo! Message
Thanks!

I put your code in and received this error:

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Mailer.AddReplyTo'

/sendLink.asp, line 40

I deleted the line and it works!

Now another problem: the link in the email doesn't appear like a link. How can I make it clickable by someone reading it?

This is what appears in the email right now without links:
Email Sener (mailto:emailsender@hotmail.com) thought you would be interested in this article Link: http://www.domainname.org/BookDetail.asp?item_id=90&

This is what is making it appear like that:

Mailer.BodyText = sendersName & " (mailto:" & sendersEmail & ") thought you would be interested in this article " & vbcrlf & vbcrlf & vbcrlf & "Link:" & vbcrlf & request.ServerVariables("HTTP_REFERER")

How can I change it to make the link clickable in an email?

Thanks for your help!


Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 01 May 2002 :  17:34:17  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
Mailer.BodyText = sendersName & " (mailto:" & sendersEmail & ") thought you would be interested in this article " & vbcrlf & vbcrlf & vbcrlf & "Link:" & vbcrlf & <A href=""" & request.ServerVariables("HTTP_REFERER") & """>" & request.ServerVariables("HTTP_REFERER") & "</a>" & VbCrlf


This is probably not the best way to do it but it should work.

@tomic

http://www.skepticfriends.org
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 01 May 2002 :  17:35:23  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
Oh, and this page http://www.serverobjects.com/comp/Aspmail4.htm is a really good one to check out

@tomic

http://www.skepticfriends.org
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07