Auto-reply via API
1/ The date start and the date end must be match to the following regexp :
/^(\\d{4})-(\\d{2})-(\\d{2})\\s+(\\d{1,2})\\:(\\d{1,2})\\:(\\d{1,2})(.[0-9]{1,6})?$/
By example :
2016-02-10 15:20:00
2/ For more information, feel free to read the following wiki page:
https://wiki.gandi.net/en/mail/create-email-autoreply
3/ The php code.
'domain.', 'sslverify' => False ) ); define('API_KEY', ''); function activateResponder($api, $domainname, $mailbox, $content, $date) { $responder_spec = [ 'content' => $content, 'date' => $date, ]; $result = $api->__call( 'mailbox.responder.activate', array(API_KEY, $domainname, $mailbox, $responder_spec) ); print_r($result); } function deactivateResponder($api, $domainname, $mailbox, $date) { $responder_spec = [ 'date' => $date, ]; $result = $api->__call( 'mailbox.responder.deactivate', array(API_KEY, $domainname, $mailbox, $responder_spec) ); print_r($result); } // Activate the responder $domainname = 'mywebsite.com'; $mailbox = 'contact'; $content = 'I am in vacation'; $date = '2016-02-10 14:51:00'; activateResponder($api, $domainname, $mailbox, $content, $date); // Desactivate the responder // Comment the previous responder call and // Uncomment the following code: /* $domainname = 'mywebsite.com'; $mailbox = 'contact'; $date = '2016-02-10 15:20:00'; deactivateResponder($api, $domainname, $mailbox, $date); */ ?>
4/ Python code.
Auto-reply activation:
#!/usr/bin/python3 import pprint import xmlrpc.client import sys pp = pprint.PrettyPrinter(indent=4) api = xmlrpc.client.ServerProxy('https://rpc.gandi.net/xmlrpc/') apikey = '' print("Mailbox Responder") responder = api.domain.mailbox.responder.activate(apikey, 'mywebsite.com', 'contact', { 'content' : 'I am in vacation', 'date' : '2016-02-10 14:22:00'}) print(responder) Auto-reply desactivation: #!/usr/bin/python3 import pprint import xmlrpc.client import sys pp = pprint.PrettyPrinter(indent=4) api = xmlrpc.client.ServerProxy('https://rpc.gandi.net/xmlrpc/') apikey = ' ' print("Mailbox Responder") responder = api.domain.mailbox.responder.deactivate(apikey, 'mywebsite.com', 'contact', { 'date' : '2016-02-10 14:22:00'}) print(responder)
Comments are closed, but trackbacks and pingbacks are open.