|
| |
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 5/30/2005 23:22:07
Brian! I haven't been able to make that work. I did find a script at ASPemail.com (support.persists.com, actually):
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.myisp.com"
Mail.From = "[email=me@mycompany.com]me@mycompany.com[/email]"
Mail.Subject = "Hello!"
Addresses = "[email=name1@company.com,name2@company.com,name3@company.com]name1@company.com,name2@company.com,name3@company.com[/email]"
Do
NextComma = InStr(Addresses, ",")
If NextComma = 0 Then
Mail.AddAddress Trim(Addresses)
Exit Do
End If
Address = Left(Addresses, NextComma - 1)
Mail.AddCC Trim(Address)
Addresses = Mid(Addresses, NextComma + 1)
Loop
Mail.Send
I adapted it to use the non-array version of the e-mail addresses. I used: Dim vEmails vEmails = Request.Form("Emails") and: Do NextColon = InStr(vEmails, ";") If NextColon = 0 Then Mail.AddAddress Trim(vEmails) Exit Do End If Address = Left(vEmails, NextColon - 1) Mail.AddBCC Trim(Address) vEmail = Mid(vEmail, NextColon + 1) Loop Mail.Send But the script take a long time and then times out... Any ideas? Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 5/31/2005 0:06:31
Yeah, I saw that too. It was too much for my brain to comprehend at the time, and why I suggested my simpler version. Anyway, I'm with Spooky since its not working. Let's try just adding one BCC manually, then try two manually, just to see if that works. Then, lets write a loop to gather all of yours if it did work.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 5/31/2005 0:54:45
Thanks, guys. I'll give it a shot and let you know. BTW, I realize that since the e-mails are being sent separately, the e-mail addresses can be put into the To: field. All recipients will get a separately addressed e-mail, right? Stephen
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/2/2005 13:02:05
Guys! The code actually works. I mistyped it!!! I altered the code this way:
Do
NextComma = InStr(vEmails, ",")
If NextComma = 0 Then
Mail.AddAddress Trim(vEmails)
Exit Do
End If
Address = Left(vEmails, NextComma - 1)
Mail.AddBCC Trim(Address)
vEmails= Mid(vEmails, NextComma + 1)
Loop
and changed the Emails variable to include commas. The ony issue I have is that the message I got (as a test recipient) said it was to "undisclosed-recipients:". That might trigger some Spam and AntiVirus programs... It might be a function of our mail server that I have no control over... Thanks for your help. Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/2/2005 13:08:28
Do you have a "To:" email address in your script also? I believe if you do it should get rid of the "undisclosed..." portion. When I send emails out to Bcc's, I also send it To: info@fromdomainname.com just so that there is something in the To: field.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/2/2005 13:14:58
Brian! Because the script changes AddAddress on the fly, If I enter a hard coded AddAddress (Mail.AddAddress = me@myaddress.com) it will be overwritten by the script. At least I think that's what will happen. How else can I enter a To: address? Thanks. Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/2/2005 21:13:00
You aren't allowed to set addaddress equal to anything, like a variable. You can only "add" to addaddress. So, you could hard code something like: Mail.AddAddress "info@mydomainname.com", and then you would always insure that at the least this email address is there.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/2/2005 21:26:10
Well, this is interesting. I added Mail.addAddress "info@anmt.org" I tested the process and the e-mails were sent. The e-mail I got (I'm on the test list) was To: info@anmt.org. Shouldn't each person get an e-mail addressed to him/her (in the To: field) as well as an e-mail being sent to info@anmt.org??? Perhaps I have misunderstood how BCC works. Stephen
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Ubound error - 6/2/2005 23:50:39
I am pretty sure that if you are a bcc recipient of a message, you do NOT show in the TO: field.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/3/2005 0:22:01
Duane is correct. BCC, which stands for Blind Carbon Copy, means this is a hidden recipient. Only those in "To" and "Cc" show up. You currently have 1 email going out like so: To: info@anmt.org Cc: Bcc: your list of built emails from vEmails Subject: Hello! ... If you want each person to get their "own" email, meaning an email with their name in the "To:", and only their name, then you need to send separate emails for each one. If you have 5 To's you would need to send 5 emails, etc. Does that help?
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/3/2005 1:58:08
I thought the Loop in the script (below) did just that - send individual e-mails with addresses drawn from and array.
Function die(strInput)
response.write strInput
response.end
End Function
Dim vEmails
vEmails = Request.Form("Emails")
'change to address of your own SMTP server
strHost = "mail.anmt.org"
strReturn = Request.Form("Return")
strBody = ""
strMessage = trim(Request.Form("Message"))
if not strMessage = "" then
strBody = strBody & vbcrlf & strMessage & vbcrlf
end if
'////////////////////////
'die strBody
'////////////////////////
Set Mail = Server.CreateObject("Persits.MailSender")
' enter valid SMTP host
Mail.Host = strHost
Mail.From = "academy@anmt.org" ' From address
'Mail.FromName = trim(Request.Form("FromName")) ' optional
Mail.AddAddress "info@anmt.org"
' message subject
Mail.Subject = Request.Form("Subject")
' message body
Mail.Body = strBody
strErr = ""
bSuccess = False
On Error Resume Next ' catch errors
Do
NextComma = InStr(vEmails, ",")
If NextComma = 0 Then
Mail.Addaddress Trim(vEmails)
Exit Do
End If
Address = Left(vEmails, NextComma - 1)
Mail.AddBCC Trim(Address)
vEmails= Mid(vEmails, NextComma + 1)
Loop
Mail.Send
If Err <> 0 Then ' error occurred
strErr = Err.Description
Response.Write "halted : " & strErr
else
bSuccess = True
' Response.Redirect(strReturn)
End If
%>
Then I see that the Mail.send command is outside the Loop, so I don't really inderstand how it is working. Hmmmm.... Stephen
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/3/2005 11:38:36
I commented out the error checking and the script works fine. I can get it to send the e-mails to all recipients, but addressed To: "undisclosed-recipients". Or, if I put an address in AddAddress (close to the top), all recipients get an email addressed To: that address. I can also get it to send to all recipients but they get e-mail addressed to all the addresses. Of course, I'd like the recipients to see ONLY their address in the To: field... I have contacted Peter Persits. He said: If you don't call AddAddress at all, just AddBcc, you would probably have that result... I've tried ALL SORTS of combinations, but no luck. Thanks. Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/3/2005 12:36:26
I'm headed out the door, so real quick - what you want to do is loop through your names, then for each name you want to send the email (not build up the list, as we were). Then clear out the recipients, add a new email name and send another, until you loop through all of the names. So, there is no need for BCCing anymore, just add to the TO, then send, reset the values, and add to the To, and send again... Something like this:
Do
' Reset all of the addressing to nothing
Mail.reset
Mail.From = "academy@anmt.org" ' From address
Mail.AddAddress "info@anmt.org"
NextComma = InStr(vEmails, ",")
If NextComma = 0 Then
Mail.Addaddress Trim(vEmails)
Mail.Send
Exit Do
End If
Address = Left(vEmails, NextComma - 1)
Mail.Addaddress Trim(Address)
vEmails= Mid(vEmails, NextComma + 1)
Mail.Send
Loop
I wrote this real quick, so there may be a syntax, or logic, error, but it should give you the idea.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/3/2005 13:55:16
Thanks, Brian! In fact, this is a step forward. Now the e-mails are addressed to info@anmt.org AND the single recipient. I've played with the code and every time I think I have it I get an error: halted : 503 RCPT first (#5.5.1) halted : 503 RCPT first (#5.5.1) This, I gather means there is no recipient. However, even with the error message on the screen the e-mail gets deilvered with JUST the recipients address. So I guess at least part of the script is running properly. There are four addresses in my test variable, so the script must run three times past the If NextComma = 0 ... End If, and then run through the code in the If ... End If. As I said if I remove the AddAddress above the If, I get an error even though AddAddress is present both in the If and after it... I've set it back to the script you sent. Is the problem that AddAddress does just that - adds an address to the To: field? It seems that there must be something in AddAddress all the time, otherwise - error. Thanks everyone for your help. Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/3/2005 16:43:37
Oh, you can get rid of the "Mail.AddAddress "info@anmt.org" since it isn't needed anymore, if you stay with the separate emails. I'm not exactly sure what the 503 error is. One place has said the "From:" is missing. Is there a "From" filled in when you recieve the email? And yes, I beleive there should always be something in the AddAdress, otherwise you will get the "undisclosed recipient" message.
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/4/2005 16:46:04
I just don't get it. If I comment out the AddAddress above the Loop, I get an error. I've tried all sorts of permutations, all of which cause errors (though e-mails are sent!) and some of which cause two e-mails to be sent. When I turn of programmatic error checking the error points to line 64: Do ' Reset all of the addressing to nothing Mail.reset Mail.From = "academy@anmt.org" ' From address 'Mail.AddAddress "info@anmt.org" NextComma = InStr(vEmails, ",") If NextComma = 0 Then Mail.Addaddress Trim(vEmails) -> Mail.Send <- Exit Do End If Address = Left(vEmails, NextComma - 1) Mail.Addaddress Trim(Address) vEmails= Mid(vEmails, NextComma + 1) Mail.Send Loop This says to me that the Loop is working but the If - End If is not, since it only gets into the If AFTER all but one e-mails are sent. Does that make sense? Stephen
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/4/2005 17:38:31
I think I figured out what the problem is. I added after If NextComma = 0 response.write NextComma response.write vEmails response.end NextComma displayed as 0 vEmails didn't display at all. Which, I suppose, means that it is empty. If I understand the code correctly, by the time it gets to the If, vEmails should still have one e-mail address left. I don't know how vEmail became empty... I'm testing changing the code to: NextComma = InStr(vEmails, ",") If NextComma = 0 Then Exit Do End If I'll let you know what happens. Stephen
|
|
|
|
sgreen0
Posts: 734 From: Long Beach, CA, USA Status: offline
|
RE: Ubound error - 6/5/2005 11:58:20
Yes, either condition works. If vEmails="" Then Exit Do End If or If NextComma=0 Then Exit Do End If All the e-mails get sent with the individual addressees. Stephen
|
|
|
|
ou812
Posts: 1742 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: Ubound error - 6/5/2005 12:10:42
Stephen, glad to hear you got it sorted out!
_____________________________
-brian Black Holes suck. EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|