Re: [OT] envio de multiples emails (con rebol) (ejemplo)
| From: | Dr Zippie | Date: | Wed, 13 Nov 2002 15:42:46 +0000 |
| Subject: | Re: [OT] envio de multiples emails (con rebol) (ejemplo) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-29188@lists.php.net to get a copy of this message | ||
En la web de rebol hay muchos scripts en la seccion de library. como decia un sistema de mailing son
apenas 3 lineas ... pero ya hay scripts con control de errores...
un ejemplo para hacer un mailing ...
--- inicio mailing.r ---
REBOL [
Title: "Email Blaster"
Date: 22-June-2000
File: %mailing.r
Purpose: {
Send an email to everyone on a spreadsheet of email
addresses. Personalize the greeting for each. Keep
a log of who was been sent the message.
}
Category: [email net 3]
]
letter-file: %letter.txt
names-file: %names.txt
date-stamp: now
;-- Who the email is FROM:
from-email: who@domain.com
;-- Who the email should be replied to:
reply-email: who@domain.com
;-- Subject line of email:
subj: "Message title"
;-- Organization line of email:
org: "Your org"
;-- Read form letter:
letter: read letter-file
;-- Read Excel spreadsheet: col1: email, col2: name
csv: read/lines names-file
targets: make block! length? csv
foreach line csv [append/only targets parse/all line ","]
;-- Verify data format:
foreach item targets [
if not all [
not error? try [item/1: load item/1]
email? item/1
string? item/2
][
print ["Invalid target:" mold item]
err-flag: true
]
]
if value? 'err-flag [halt]
;-- Create log file:
log-file: join %blast- [date-stamp/date "-" date-stamp/time/hour ".txt"]
print ["Log file is:" log-file]
write log-file reduce [date-stamp newline]
;-- Compose email header:
header: make system/standard/email [
subject: subj
from: from-email
reply: reply-email
Organization: org
date: to-idate date-stamp
]
;-- Compose and send each letter:
foreach item targets [
set [to-addr name] item
contents: rejoin ["Dear " name ";" newline newline letter]
send/header copy to-addr contents make header [to: to-addr]
print [to-addr "sent"]
write/append log-file reduce [to-addr newline]
]
halt
--- fin mailing.r ---
Dr Zippie (zippie(a)dr-zippie.net)
www.dr-zippie.net ** en construcción **
"El ordenador es la evolucion logica del hombre: Inteligencia sin moral": John Osborne.
"A nullo videbatur, ipse autem omnia videbat"