WebFaction
Community site: login faq

I have a list of email forwards for a domain that I need to upload to webfaction. Is there a way to do that, rather than one-by-one?

These can be formatted in any relevant manner, eg a list of pairs:

myaddress1@mydomain.com, myforwardingaddress1@anotherdomain.com

Thanks!

asked 20 May '16, 09:05

DiagonalArg's gravatar image

DiagonalArg
135
accept rate: 0%

edited 20 May '16, 12:06

How is the list formatted? Does an email address forwards to one or more addresses?

Can you update your question with a sample line?

(20 May '16, 09:10) iliasr ♦♦ iliasr's gravatar image

@iliasr - It's in a spreadsheet. I can format it any way necessary. eg, as pairs: myaddress1@mydomain.com, myforwardingaddress1@anotherdomain.com. And, they do not forward to more than one address

(20 May '16, 12:04) DiagonalArg DiagonalArg's gravatar image

If you can export your list in a text file where each line contains a pair separated by a space, similar to:

myaddress1@mydomain.com myforwardingaddress1@anotherdomain.com

then a very basic python 2.7 script, without any error handling or data validation, would be:

import xmlrpclib

USERNAME = "username"  # Your WebFaction control panel username
PASSWORD = "password"  # Your WebFaction control panel password
LIST = "list.txt"      # The text file with the addresses

server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
session_id, account = server.login(USERNAME, PASSWORD)

with open(LIST, 'r') as f:
    for line in f:
        address, target = line.split()
        print("Doing {0}".format(address))
        server.create_email(session_id, address, target)

You will need to update the USERNAME, PASSWORD and LIST variables accordingly.

permanent link

answered 20 May '16, 12:22

iliasr's gravatar image

iliasr ♦♦
1.7k4
accept rate: 37%

edited 20 May '16, 12:35

@iliasr - thank you! I will test this and return to let you know how it worked.

(20 May '16, 12:25) DiagonalArg DiagonalArg's gravatar image

It worked! It worked! :^) Thanks iliasr. Yr a God!

(22 May '16, 21:46) DiagonalArg DiagonalArg's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×27
×9
×4

question asked: 20 May '16, 09:05

question was seen: 595 times

last updated: 22 May '16, 21:46

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2017 PARAGON INTERNET GROUP LIMITED
WEBFACTION IS A SERVICE OF PARAGON INTERNET GROUP LIMITED
REGISTERED IN ENGLAND AND WALES 7573953 - VAT REGISTRATION NUMBER 182147021
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM