ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 5th, 2005, 08:53 AM
adamskii adamskii is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 10 adamskii User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 9 sec
Reputation Power: 0
Lightbulb Requesting info from external document

Im trying to set up an automated newsletter emailer, which, when a button is pressed, generates an (html) email and sends it to the recipients listed in an external document.

I have an html page with a form button which actions the code below. The email is then generated and sent as required. However, I have been unable to get the code to include the recipient information that is stored in a seperate document.

Code:
 <% @language="VBSCRIPT" %>
<% 
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Waste Aware Scotland Magazine"
myMail.From="info@wascot.org.uk"
myMail.To="swag@gotadsl.co.uk"
myMail.HTMLBody="<head><style type='text/css'><!--a:link {text-decoration: none;color: #006666;}a:visited {text-decoration: none;color: #666666;}a:hover {text-decoration: underline;}a:active {text-decoration: none;}.style2 {color: #666666}--></style><style type='text/css'>.BasicText {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;text-align: left;line-height: normal;font-style: normal;}.compost-subheader {font-family: Arial, Helvetica, sans-serif;font-size: 14px;font-weight: 900;text-transform: none;}}.BasicTextCompact {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}</style></head><table width='552' border='0' cellspacing='0' cellpadding='0'><tr><td></td><td><div align='center'><span class='BasicTextCompact'>This message contains graphics. If you do not see the graphics, <A href='http://www.wascot.org.uk/WAS_email.htm' target='_blank'>click here to view</A>.</span> </div></td><td></td></tr><tr bgcolor='#666666'><td width='1' height='1'></td><td></td><td width='1'></td></tr><tr><td bgcolor='#666666'></td><td><table width='550' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td height='52'><img src='http://www.wascot.org.uk/graphics/mag_email/topstrip_email.gif' width='550' height='52'></td></tr><tr><td height='1' bgcolor='#666666'></td></tr><tr><td width='398' height='10' bgcolor='#CCCCCC'></td></tr><tr><td valign='top'><table width='550' border='0' cellpadding='3' cellspacing='0' bgcolor='#CCCCCC'><tr><td><span class='compost-subheader'>Now Available - Waste Aware Scotland magazine Issue 8 </span></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td height='5'></td><td></td><td></td></tr><tr><td valign='top'><p class='BasicText'>In this edition of Waste Aware Scotland:</p><ul><li class='BasicText'> <strong>Sort It V.2</strong> - SWAG's new and improved information tool aims to make easier than ever to reduce, reuse and recycle&nbsp; your household waste.</li><li class='BasicText'><strong>Waste Surgery</strong> - Vicky, SWAG's Public Enquiries Officer, answers all your Christmas waste problems.</li><li class='BasicText'><strong>On the Campaign Trail</strong> - Find out what's been happenning in your area.</li><li class='BasicText'><strong>Competition</strong> - Win a wind up radio.</li></ul></td><td width='10'>&nbsp;</td><td width='125' rowspan='3' valign='top'><img src='http://www.wascot.org.uk/graphics/magcover_issue8.gif' width='120' height='170' border='1'></td></tr><tr><td height='5'></td><td></td></tr><tr><td valign='top'><ul><li class='BasicText'>To download the latest version of Waste Aware Scotland magazine, <a href='http://www.wascot.org.uk/pdf%27s/Waste_Aware_issue_8.pdf' target='_blank'>click here</a>. <span class='BasicTextCompact'>(right click and save as.)</span></li></ul><ul><li class='BasicText'>You can visit <a href='http://www.wascot.org.uk' target='_blank'>www.wascot.org.uk</a> and read or download the magazine from there.</li></ul><ul><li class='BasicText'>Alternatively, you can have the magazine sent directly to your door. <a href='http://www.wascot.org.uk/WAS_Mag.asp' target='_blank'>Click here</a> to subscribe.</li></ul></td><td>&nbsp;</td></tr></table><table width='550' border='0' cellpadding='0' cellspacing='0'><tr bgcolor='#666666'><td height='1'></td><td></td><td></td></tr><tr><td width='75' class='compost-subheader'><img src='http://www.wascot.org.uk/graphics/mag_email/xmas2.gif' width='75' height='50'></td><td class='compost-subheader'><div align='center'>Happy New Year from Waste Aware Scotland! </div></td><td width='145'><img src='http://www.wascot.org.uk/graphics/mag_email/xmas.gif' width='145' height='50'></td></tr><tr bgcolor='#666666'><td height='1'></td><td></td><td></td></tr></table></td></tr><tr><td bgcolor='#CCCCCC'><blockquote><p class='BasicTextCompact'>The Waste Aware Scotland Magazine is a free, voluntary subscription magazine. <br>If you wish to be removed from this mailing list, please <a href='mailto:rachel.burns@ksbscotland.org.uk'>email us</a>.</p></blockquote></td></tr><tr><td height='1' bgcolor='#666666'></td></tr><tr><td height='52'><a href='http://www.wascot.org.uk' target='_blank'><img src='http://www.wascot.org.uk/graphics/mag_email/footer.gif' width='550' height='52' border='0'></a></td></tr></table></td><td bgcolor='#666666'></td></tr><tr bgcolor='#666666'><td height='1'></td><td></td><td></td></tr></table>"
myMail.Send
Set myMail = Nothing
%>
<html>
<link href="../css/website.css" rel="stylesheet" type="text/css">
<body>
<p class="BasicText">The newsletters have been sent.</p>
</body>
</html>


I have attempted defining a variable using #include as shown below, but the myMail.To=variablename doesnt work.

Code:
 Dim recipients 
 
recipients=<!--#include file="emails.asp"-->
 
myMail.To=recipients 


I really dont know if Im on the right track or not?
Any help will be greatly appreciated.

Cheers.

Reply With Quote
  #2  
Old January 12th, 2005, 05:31 PM
Anibal Anibal is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 176 Anibal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 14
Hey Mate!. Just read you post. Since, better late than never , here's my reply. Try placing the code for the mail inside a function like this:

Function SendMail(dest)

End Function

Then, parse the document, and for each destinatary in the document, invoque the function. That should send all the mails you need to send.
If you want to send it with a string holding dest1, dest2, dest3 (assuming that the object allows this)..just parse the document and do:
destString = desString & dest & ","
Be carefull with the last coma!!!

Hope it works!!

Anibal.

Reply With Quote
  #3  
Old January 14th, 2005, 09:00 AM
altan altan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 4 altan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 6 sec
Reputation Power: 0
Hello, here is a solution:

emails.asp:
<%
Dim strEmails
strEmails = "mail1@server1.com,mail2@server2.com,.... "
%>
Code:
<% @language="VBSCRIPT" %>
<!--#include file="emails.asp"-->
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Waste Aware Scotland Magazine"
myMail.From="info@wascot.org.uk"
myMail.To=strEmails
myMail.HTMLBody="<head>....."
myMail.Send
Set myMail = Nothing
%>
<html>
<link href="../css/website.css" rel="stylesheet" type="text/css">
<body>
<p class="BasicText">The newsletters have been sent.</p>
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Requesting info from external document


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap