Send bulk e-mail fra skabelon med Python
Send bulk-e-mail til en gruppe adresser ved hjælp af en skabelon med Python
Python : API-DOKUMENTATION
- Opret gruppe med Python
- Hent gruppe feltliste med Python
- Føj et felt til en gruppe med Python
- Slet et felt fra en gruppe med Python
- Slet en kontakt fra en gruppe
- At give land en e-gruppe med Python
- Hent gruppekontaktliste med Python
- Føj kontakt til en gruppe med Python
- Rediger kontakt for en gruppe med Python
- Slet kontakt fra en gruppe med Python
Send bulk e-mail fra skabelon med Python
import urllib2
afilnet_class="email"
afilnet_method="sendemailtogroupfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idgroup="1000"
afilnet_idtemplate="1000"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="email"
afilnet_method="sendemailtogroupfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idgroup="1000"
afilnet_idtemplate="1000"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/"
data = urlencode({"class": afilnet_class,"method": afilnet_method,"user": afilnet_user,"password": afilnet_password,"idgroup": afilnet_idgroup,"idtemplate": afilnet_idtemplate,"scheduledatetime": afilnet_scheduledatetime,"output": afilnet_output}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="email"
afilnet_method="sendemailtogroupfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_idgroup="1000"
afilnet_idtemplate="1000"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
Parameter | Beskrivelse | Obligatorisk / valgfri |
---|---|---|
class=email | Klasse anmodet: Klasse, som anmodningen indgives til | Obligatorisk |
method=sendemailtogroupfromtemplate | Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til | Obligatorisk |
user | Bruger og e-mail på din Afilnet-konto | Obligatorisk |
password | Adgangskode til din Afilnet-konto | Obligatorisk |
idgroup | Identifikator for destinationsgruppen | Obligatorisk |
idtemplate | email.sendemailtogroupfromtemplate_idtemplate | Obligatorisk |
scheduledatetime | Leveringsdato og -tid i åååå-mm-dd tt: mm: ss-format | Valgfri |
output | Outputformat for resultatet | Valgfri |
Når du fremsætter anmodninger, modtager du følgende felter:
- status
-
resultat (hvis status = succes), her vil du modtage følgende værdier:
- id
- count
- credits
-
destinations
- messageid
- destination
- fejl (hvis status = fejl), her vil du modtage fejlkoden
De mulige fejlkoder er vist nedenfor
Kode | Beskrivelse |
---|---|
MISSING_USER | Bruger eller e-mail er ikke inkluderet |
MISSING_PASSWORD | Adgangskode er ikke inkluderet |
MISSING_CLASS | Klasse ikke inkluderet |
MISSING_METHOD | Metode er ikke inkluderet |
MISSING_COMPULSORY_PARAM | Obligatorisk parameter ikke inkluderet |
INCORRECT_USER_PASSWORD | Forkert bruger eller adgangskode |
INCORRECT_CLASS | Forkert klasse |
INCORRECT_METHOD | Forkert metode |
NOT_ACCESS_TO_GROUP | Du har ikke adgang til den angivne gruppe |
NO_CREDITS | Din balance er utilstrækkelig |
Parametre:
- class : email
- method : sendemailtogroupfromtemplate
- user : user
- password : password
- idgroup : 1000
- idtemplate : 1000
- scheduledatetime :
- output :
Anmodning:
https://www.afilnet.com/api/http/?class=email&method=sendemailtogroupfromtemplate&user=user&password=password&idgroup=1000&idtemplate=1000&scheduledatetime=&output=