Title: Causes CLI errors because SERVER_NAME is not available
Last modified: September 18, 2016

---

# Causes CLI errors because SERVER_NAME is not available

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [9 years, 8 months ago](https://wordpress.org/support/topic/causes-cli-errors-because-server_name-is-not-available/)
 * Every time I used WP-CLI, I got this error: Notice: Undefined index: SERVER_NAME
 * That’s because SERVER_NAME is not available via command line. There is a fix 
   though.
 * Edit the file: `postman-smtp/Postman/Postman-Mail/PostmanDefaultModuleTransport.
   php`
 * Change this (line 37):
 * `$sitename = strtolower ( $_SERVER ['SERVER_NAME'] );`
 * To this:
 *     ```
       $siteurl = parse_url( esc_url( site_url() ) );
       $sitename = $siteurl['host'];
       ```
   
 * Works fine now 🙂

Viewing 1 replies (of 1 total)

 *  [YEWS-Grigory](https://wordpress.org/support/users/yews-grigory/)
 * (@yews-grigory)
 * [9 years ago](https://wordpress.org/support/topic/causes-cli-errors-because-server_name-is-not-available/#post-9158005)
 * great, this seems to fix it for me. Thanks Ipstenu!
    Will this be updated in 
   the plugin? or will we have to always do this after each plugin update?

Viewing 1 replies (of 1 total)

The topic ‘Causes CLI errors because SERVER_NAME is not available’ is closed to 
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/postman-smtp_7c7b78.svg)
 * [Postman SMTP Mailer/Email Log](https://wordpress.org/plugins/postman-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/postman-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/postman-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/postman-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/postman-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/postman-smtp/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/causes-cli-errors-because-server_name-is-not-available/)
 * Status: not resolved