Get Virtualizor

Email Settings

You can configure how Virtualizor will deliver notification emails through Use the Email Settings API.

Virtualizor can deliver emails either through PHP internal Mail service or using external SMTP server.

This API allows you to either enable or disable notification emails. If disabled, Virtualizor will not send email notifications. The API response will contain "done" as "1" on successful update of the email settings.

HTTP Request

https://hostname:4085/index.php?act=emailconfig

Parameters

NameMethodValueDescriptionRequired
actGETemailconfigThe action will set the email configuration required to send mail to usersYes
editemailconfigsettingsPOST1/0If set then the email configuration will be savedYes
mailPOST1/0Select which type of mailing should be used to send mails 1 for PHP Mail and 0 for SMTPYes
mail_serverPOSTmail_serverThe mail server that will be used to send mailsYes
mail_portPOSTIntThe default port that will be used to send mailsYes
mail_userPOSTmail_userThe users ID from which the mail will be sentYes
mail_passPOSTpassPassword of the user emailYes
mail_smtp_securePOSTIntSecurely Connect to mail server using the selected mode.(0 for None, 1 for SSL, 2 for STARTTLS)No
mail_connect_timeoutPOSTIntThe value for connection timeout should be greater than 5No
mail_debugPOST1/0If set then the debug logs will be saved to check in case sending mail fails at /var/virtualizor/logNo
disable_emailPOST1/0If set to 1 no email will be sent by the systemNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['editemailconfigsettings'] = 1;
    $post['mail'] = 0;
    $post['mail_server'] = 'mail_server';
    $post['mail_port'] = 25;
    $post['mail_user'] = 'test@test.com';
    $post['mail_pass'] = 'test';
    $post['mail_smtp_secure'] = 0;
    $post['mail_debug'] = 1;
    $post['mail_connect_timeout'] = 6;

    $output = $admin->emailconfig($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Email Settings",
    "done": 1,
    "info": {
        "path": "/usr/local/virtualizor",
        "slave": 0,
        "masterkey": "",
        "masterip": "",
        "key": "lf6klmphhpyrxqacmuebs2ioxlzrc37g",
        "pass": "ti3thxss38v8jj6cybhwdc1xvghyetob",
        "kernel": "kvm",
        "lv": "",
        "thin_lv": "",
        "disk_path": "",
        "dbhost": "localhost",
        "db": "virtualizor",
        "dbuser": "root",
        "dbpass": "25etajy45w",
        "sn": "API Virt",
        "cookie_name": "SIMCookies3042",
        "gzip": 0,
        "cpu_nm": 0,
        "overcommit": 0,
        "language": "english",
        "soft_email": "test@test.com",
        "theme_folder": "test",
        "timezone": "0",
        "update": 0,
        "email_update": 0,
        "email_update_client": 0,
        "cron_time": "18 16 * * 3",
        "emps_cron_time": "18 16 * * 3",
        "logo_url": "",
        "logo_login_url": "",
        "mail": 0,
        "mail_server": "mail_server",
        "mail_port": 25,
        "mail_user": "test@test.com",
        "mail_pass": "test",
        "mail_smtp_secure": 0,
        "mail_debug": 0,
        "mail_connect_timeout": 0,
        "off": 0,
        "off_subject": "",
        "off_message": "",
        "admin_logs": 2,
        "vps_logs": 2,
        "login_logs": 2,
        "system_logs": 2,
        "status_logs": 7,
        "bandwidth_logs": 0,
        "sess_len": 100000,
        "copyright": "",
        "interface": "",
        "xen_pvbridge": "",
        "xen_hvmbridge": "",
        "xen_dom0mem": 0,
        "use_xl": "",
        "ipadd": "",
        "netmask": "",
        "gateway": "",
        "ip6add": "",
        "gateway6": "",
        "int_bridge": "",
        "int_ipadd": "",
        "int_netmask": "",
        "login_attempts": 5,
        "login_ban_time": 15,
        "alert_load_limit": 0,
        "alert_disk_limit": 0,
        "vswap": 0,
        "noc_apikey": "",
        "noc_apipass": "",
        "disable_webuzo": "",
        "disabled_scripts": "",
        "disable_icons_monitor": 0,
        "disable_icons_cp": 0,
        "disable_email": 0,
        "node_bandwidth": 0,
        "vps_bandwidth_threshold": 0,
        "change_ssh_port": 0,
        "max_ssh_login": 0,
        "vnc_ip": "",
        "ping_ip": "",
        "distro": "",
        "dhcp_interface": "",
        "support": "",
        "addvs_io_class": "",
        "addvs_io_prio": "",
        "addvs_cpu_prio": "",
        "vpslimit": "",
        "ploop": 0,
        "enable_tuntap_cp": 0,
        "enable_ppp_cp": 0,
        "enable_fuse_cp": 0,
        "enable_ipip_cp": 0,
        "enable_ipgre_cp": 0,
        "enable_nfs_cp": 0,
        "enable_quotaugidlimit_cp": 0,
        "enable_iolimit_cp": 0,
        "enable_iopslimit_cp": 0,
        "enable_enduser_vnc": 0,
        "show_server": 0,
        "band_suspend": 0,
        "speed_cap_disable": 0,
        "is_master_only": 0,
        "xcp_lv_prefix": "",
        "novnc": 0,
        "novnc_master_only": 0,
        "novnc_server_name": 0,
        "queue_creation": 0,
        "disable_dd_flags": 0,
        "dbbackup_email": "",
        "dbbackup_cron": "",
        "dbbackup_type": "EMAIL",
        "dbbackup_server": 0,
        "dbbackup_server_dir": "",
        "is_cloud": "",
        "bridge": "viifbr0",
        "pv_on_hvm": 0,
        "band_calc_creation": 0,
        "no_ebtables_on_plans": "",
        "master_name": "",
        "inodes_gb": "",
        "openvz_suspend_load": 0,
        "disable_login_logo": 0,
        "enable_rdns": 0,
        "disable_backup_cp": 0,
        "auto_add_zone": 0,
        "enable_console": 0,
        "curl_timeout": "",
        "del_novps_user": 0,
        "del_slave_ostemplate": 0,
        "disable_master_vpsname": 0,
        "showsearch": 0,
        "site_domain": "",
        "use_new_theme": "",
        "turnoff_virtdf": 1,
        "disable_newtheme": 0,
        "disable_recipes": 0,
        "enable_virtio": 0,
        "disable_suspend_email": 0,
        "enable_idsort": 0,
        "del_tasks": 0,
        "disable_apicredential": 0,
        "disable_rescue": 0,
        "disable_change_hostname": 0,
        "disable_change_password": 0,
        "disable_vps_config": 0,
        "disable_os_reinstall": 0,
        "disable_ssh": 0,
        "disable_java_vnc": 0,
        "disable_self_shutdown": 0,
        "disable_server_location": 0,
        "disable_enduser_sshkeys": 0,
        "disable_vga": 0,
        "enable_nic": 0,
        "cb_hash": "oidzotex0av7rueyzonhnbn7nokndmgd",
        "enable_cb": 0,
        "cb_use_https": 0,
        "cb_url": "",
        "cb_suspend": 0,
        "cb_unsuspend": 0,
        "cb_hostname": 0,
        "cb_terminate": 0,
        "cb_changeips": 0,
        "default_sg_name": "",
        "default_sg_reseller_name": "",
        "default_sg_desc": "",
        "custom_mac": "",
        "cloud_allow_virtio": 0,
        "le_primary_domain": "",
        "le_contact_email": "",
        "le_key_size": 4096,
        "le_renew_days": 80,
        "le_staging": 0,
        "le_enable_force": 0,
        "2fa_email_otp": 0,
        "enable_2fa": 0,
        "eu_allow_virtio": 0,
        "keep_orphan_template": 0,
        "pass_strength": 0,
        "haproxy_enable": 0,
        "haproxy_src_ips": "127.127.127.1",
        "haproxy_reservedports": "",
        "haproxy_reservedports_http": "80,443",
        "haproxy_allowedports": "",
        "haproxy_cron_logs": 0,
        "backup_queue": 0,
        "restore_queue": 0,
        "server_latitude": 0,
        "server_longitude": 0,
        "disable_nw_config": 0,
        "enable_eu_iso": 0,
        "eu_iso_size": "",
        "eu_iso_limit": "",
        "eu_iso_space": "",
        "eu_iso_del_hr": "",
        "secure_allowed_ips": "",
        "backup_email": "",
        "backup_disable_success_mail": 0,
        "disable_virttop": 0,
        "set_def_hvm": 0,
        "memory_limit": 0,
        "proxmox_server_pass": "",
        "proxmox_server_name": "",
        "proxmox_server_pass_salt": "",
        "max_ips": 250,
        "cp_url": "http://",
        "inhouse_billing": 0,
        "enable_registration": 0,
        "user_pass_min_char": 8,
        "support_email": "",
        "default_uplid": 0,
        "billing_warn_bal": 80,
        "billing_currency": "USD",
        "billing_symbol": "$",
        "billing_min": "50",
        "billing_max": "1000",
        "billing_day": 0,
        "billing_comp": "",
        "billing_addr1": "",
        "billing_addr2": "",
        "paypal_account": "",
        "paypal_api_user": "",
        "paypal_api_pass": "",
        "paypal_api_sig": "",
        "paypal_env": "",
        "captcha_secret": "",
        "captcha_sitekey": "",
        "resource_pricing": "",
        "recipe_shell": "#!/bin/sh",
        "hf_loaded": 0,
        "charset": "UTF-8",
        "showntimetaken": 1,
        "version": "2.9.7",
        "patch": "0",
        "license": "VIRTD-81008-78272-55853-14018",
        "port": 4082,
        "vpsid": 0,
        "index": "index.php?",
        "server": 0,
        "queries": 0,
        "docs": "https://www.virtualizor.com/wiki/",
        "apiurl": "https://api.virtualizor.com/",
        "openvzos": "/vz/template/cache",
        "xenos": "/var/virtualizor/xen",
        "kvmos": "/var/virtualizor/kvm",
        "xcpos": "/var/virtualizor/xcp",
        "lxcos": "/var/virtualizor/lxc",
        "proxoos": "/var/virtualizor/proxo",
        "proxkos": "/var/virtualizor/proxk",
        "proxlos": "/var/virtualizor/proxl",
        "vzoos": "/vz/template/cache",
        "vzkos": "/var/virtualizor/vzk",
        "isos": "/var/virtualizor/iso",
        "euisos": "/var/virtualizor/euiso",
        "virtualboxos": "/var/virtualizor/virtualbox",
        "var": "/var/virtualizor",
        "lxc_path": "/var/lib/lxc/",
        "virts": {
            "openvz": "openvz",
            "xen": "xen",
            "xenhvm": "xenhvm",
            "kvm": "kvm",
            "xcp": "xcp",
            "xcphvm": "xcphvm",
            "lxc": "lxc",
            "proxo": "proxo",
            "proxk": "proxk",
            "proxl": "proxl",
            "vzk": "vzk",
            "vzo": "vzo"
        },
        "mainfiles": "/usr/local/virtualizor/main",
        "adminfiles": "/usr/local/virtualizor/admin",
        "themes": "/usr/local/virtualizor/enduser/themes",
        "runtime_theme": "api",
        "webuzo_scripts": "/var/virtualizor/webuzo_scripts",
        "_disabled_scripts": [],
        "notupdated_task": 3600,
        "os": "linux",
        "com": {
            "vgdisplay": "/sbin/vgdisplay",
            "lvdisplay": "/sbin/lvdisplay",
            "lvscan": "/sbin/lvscan",
            "lvcreate": "/sbin/lvcreate",
            "lvremove": "/sbin/lvremove",
            "resizefs": "/sbin/resize2fs",
            "php": "/usr/local/emps/bin/php",
            "pgzip": "/bin/gzip"
        },
        "vcores": 0,
        "resource_types": [
            "space",
            "cores",
            "ram",
            "ips"
        ],
        "HTTP_HOST": "192.168.1.240",
        "lictype": "-1",
        "lictype_txt": "Trial",
        "active": 1,
        "active_txt": "Active",
        "licnumvs": "0",
        "primary_ip": "127.127.127.1",
        "licexpires": "20180930",
        "licexpires_txt": "30/09/2018 GMT",
        "last_edit": "1530596724",
        "fast_mirrors": [
            "https://s1.softaculous.com/a/virtualizor",
            "https://s2.softaculous.com/a/virtualizor",
            "https://s3.softaculous.com/a/virtualizor",
            "https://s4.softaculous.com/a/virtualizor",
            "https://s7.softaculous.com/a/virtualizor"
        ],
        "pgtimezone": 0,
        "apicall": "cbdyx4fv",
        "apidata": []
    },
    "timenow": 1536246723,
    "time_taken": "0.238"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list