Saturday, October 30, 2010

How to Configure Apache as a Forward / Reverse Proxy

SkyHi @ Saturday, October 30, 2010
Apache can be configured in both a forward and reverse proxy (also known as gateway) mode.



Apache as Forward Proxy:

An ordinary forward proxy is an intermediate server that sits between the client and the origin server. In order to get content from the origin server, the client sends a request to the proxy naming the origin server as the target and the proxy then requests the content from the origin server and returns it to the client. The client must be specially configured to use the forward proxy to access other sites.



A typical usage of a forward proxy is to provide Internet access to internal clients that are otherwise restricted by a firewall. The forward proxy can also use caching (mod_cache) to reduce network usage.



The forward proxy is activated using the ProxyRequests directive. Because forward proxies allow clients to access arbitrary sites through your server and to hide their true origin, it is essential that you secure your server so that only authorized clients can access the proxy before activating a forward proxy.

ProxyRequests On

ProxyVia On



<Proxy *>

Order deny,allow

Deny from all

Allow from 192.168.1

</Proxy>

Apache as Reverse Proxy:

A reverse proxy (or gateway), by contrast, appears to the client just like an ordinary web server. No special configuration on the client is necessary. The client makes ordinary requests for content the reverse proxy then decides where to send those requests, and returns the content as if it was itself the origin.



A typical usage of a reverse proxy is to provide Internet users access to a server that is behind a firewall. Reverse proxies can also be used to balance load among several back-end servers, or to provide caching for a slower back-end server. In addition, reverse proxies can be used simply to bring several servers into the same URL space.



A reverse proxy is activated using the ProxyPass directive or the flag to the RewriteRule directive. It is not necessary to turn ProxyRequests on in order to configure a reverse proxy.

ProxyRequests Off



<Proxy *>

Order deny,allow

Allow from all

</Proxy>



ProxyPass /foo http://foo.example.com/bar

ProxyPassReverse /foo http://foo.example.com/bar

REFERENCES
http://linuxpoison.blogspot.com/2010/01/configuring-apache-as-forward-reverse.html

Friday, October 29, 2010

Image Resize with PHP/ImageMagick Maintaining Proportions

SkyHi @ Friday, October 29, 2010
There are many examples found on the web on resizing images using PHP while maintaining aspect ratio. However most of them are based on a single maximum dimension i.e. should not exceed a certain size with on either height or width.

I have written the code below that will accept a desired height and width and downsize the source image without exceeding either $maxheight or $maxwidth but still maintain proportions.

Adjust your path to ImageMagick accordingly (/usr/bin/convert)

function resizeimage($source,$dest,
    $maxwidth = 200,$maxheight = 160)
{
    list($width,$height) = getimagesize($source);
    
    /**
     * We need to get both ratios so we can 
     * find which reduced height and width 
     * will fix the max allowed dimensions.
     */
    $hRatio = $maxheight / $height;
    $wRatio = $maxwidth / $width;
    
    /**
     * Test Dimensions based on height reduction ratio.
     */
    $tHeightHR = $maxheight;
    $tWidthHR = ceil($hRatio * $width);
    
    /**
     * Test dimenstions based on width reduction ratio.
     */
    $tWidthWR = $maxwidth;
    $tHeightWR = ceil($wRatio * $height);
    
    if($width < $maxwidth AND $height < $maxheight)
    {
        echo 'Source already below maximum dimensions: ' 
            . $source . " {$width}x{$height}\n";
        return false;
    }
    
    if($tWidthHR <= $maxwidth) { 
        $height = $tHeightHR; $width = $tWidthHR; 
    }
    if($tHeightWR <= $maxheight) { 
        $height = $tHeightWR; $width = $tWidthWR; 
    }
    
    $cmd = "/usr/bin/convert -resize {$width}x{$height} "
        . "\"{$source}\" \"{$dest}\" 2>&1";
    @exec($cmd,$output,$retvar);

    if($retvar != 0) 
    {
        echo implode(" -- ",$output);
        return false;
    }
    
    return true;
}  

REFERENCES
http://www.lampadmins.com/f17/image-resize-php-imagemagick-maintaining-proportions-14/
http://www.imagemagick.org/Usage/resize/

Thursday, October 28, 2010

Net Use Command examples

SkyHi @ Thursday, October 28, 2010
The NET USE command is used to associate a local drive letter or device name with a shared network drive or device. Most often, the NET USE command is used for network drive mapping.
The NET USE command can be used also to disconnect a computer from a shared resource, or to display information about computer network connections.
The NET USE command also controls persistent net connections.

What network resource can I connect to using NET USE?

When connecting to a network device using the NET USE command or the NET CONNECT command, you can connect to any of the following:
  • printer LPT1 thru LPT4, 
  • serial port COM1 thru COM4,
  • AUX1 thru AUX4
  • logical drive A: thru Z:
Logical drives are most commonly referenced devices when using the NET USE command.

Difference between NET USE and NET CONNECT

The commands NET USE and NET CONNECT are interchangeable. Originally IBM introduced the NET USE command and Microsoft used the NET CONNECT command. The NET USE command is being used more often now and is the preferred method these days.

Where NET USE is used?

The NET USE command is only available on client computers, that is most often on desktop workstations. A "client computer" in this context refers to the relationship of the computer not to the physical configuration. A client computer is the one that connects to somewhere, the one that relies on the target resource. The NETWORK.COM or CLIENT.COM modules need to be loaded for this command to work.
Before you can use any network device or drive, it must have been previously shared using the NET SHARE command from the server machine.

How do I display a list of network connections on my computer?

When you use the NET USE command without parameters, NET USE retrieves a simple list of network connections. Go to your Start menu, click Run, type cmd and hit enter. Then, type NET USE and you will see a screen similar to the following output.
Status       Local     Remote                    Network
-------------------------------------------------------------------------------
OK           H:        \\a0001-fila006-v\mpari$  Microsoft Windows Network
OK           O:        \\a0001-app9229-s\RMBech  Microsoft Windows Network
OK           P:        \\a0185-app3A43-s\QRM     Microsoft Windows Network
OK           S:        \\ho-0001-nas02\teamedm  Microsoft Windows Network
Disconnected X:        \\001-deploy1-s\mcafeedat Microsoft Windows Network
The command completed successfully.
The NET USE is very useful to get a list of connected network devices. If you need information about some particular network resource that you are connected to, you can use the following command:
NET USE [DeviceName]
This would be for example "NET USE H:" where H is your network drive.

How do I make network connections persistent (available after reboot)?

When mapping a network drive, you can tell the computer to remember your mapping after you restart the computer. If you want to make all future connections are persistent (auto-reconnect at login), use the following:
NET USE /Persistent:Yes
or
NET USE /P:Yes
If you want to make all future connections non-persistent, use the following:
NET USE /Persistent:No
or
NET USE /P:No
In this case, mapping will be lost when the computer is restarted.

How do I connect a user to his or her HOME directory?

Connecting a user to his or her HOME directory is often used in corporate setting where each user is allocated some space on the network in addition to his or her personal computer. Making this network location available every time the user logs into his or her computer can be accomplished using the NET USE command in a login script. The following is the way it works:
NET USE [devicename | *] [password | *]] [/HOME]
The devicename in this case is the HOME server/folder that is defined in Active Directory (ADUC).
In case you need to use the NET USE command to connect to a password protected file share, use the following:
NET USE [driveletter:] \\ComputerName\ShareName[\volume] [password | *]
[/USER:[domainname\]username] [/PERSISTENT:No]
The following are a few examples of this:
NET USE H: /Home
NET USE H: \\CorporateFileServer\Users\%Username%
NET USE W: \\CorporateFileServer\GroupShare /Persistent:No
Are you wondering what the /USER is?

How to specify USER in NET USE?

If you deal with enterprise security, you may need to provide user name to the NET USE command. There are two notations for giving it the user name. In the NET USE command /USER can be specified as:
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
Both work the same way.

How do I disconnect from a share using NET USE?

If you no longer need a connection to the network share, it is a good idea to disconnect from it so that it does not drain system and network resources. You can do so by using the following NET USE command:
NET USE [driveletter:] /DELETE
This should disconnect.
Important note: You cannot disconnect from a shared directory if you use it as your current drive or if an active process is using it. You can find out whether anything is using your drive by typing the NET USE [driveletter]:

Possible problem with NET USE

Mapping to a resource shared on the network using the NET USE command has some peculiarities. You can encounter a problem when trying to connect to a network share right after you map to it (when doing so in a script).
This is because the execution of the NET USE takes some time. When using the NET USE command in a script to map to a network drive, you may want to wait until the mapping has completed before continuing with further scripting commands.
START /wait NET USE [driveletter:] \\ComputerName\ShareName
The start /wait switch ensures that files can be read from the mapped drive immediately, in other words that subsequent commands in your script execute only after mapping is complete.

Syntax problem with NET USE

When using the NET USE command, you can run into some syntax-related errors. The System error 67 occurred is a very common one.
See here for more details: System error 67 has occurred.
Also, if the ServerName that you provide contains spaces, you need to use quotation marks around the text. (that would be for example "Server Name") Not providing quotation marks results in an error message: System error 85 has occurred.

Are there other related useful networking commands?

The NET SHARE command is used at the server to share a folder to others. If you want to access this shared resource from a client, you would use the NET SHARE command.
This page provides an overview of all available networking server commands: server NET commands.

NET USE syntax

The following is the syntax for NET USE:
net use
[{DEVICE | *}]
[\\COMPUTER\SHARE[\VOL]]
[{PASSWORD | *}]]
[/USER:[DOMAIN\]USER]
[/USER:[DOTTEDDOMAIN\]USER]
[/USER: [USER@DOTTEDDOMAIN]
[/SAVECRED]
[/SMARTCARD]
[{/DELETE | /PERSISTENT:{yes | no}}]
net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]
net use [/PERSISTENT:{yes | no}]
That is about it.








===============================================================
Net use command connects / disconnects the computer from a shared resource, or allow to view the information about current computer connections. This command also can controls persistent network connections. If you will use net use command without any parameters, you will retrieves a list of network current connections.


net use command window

Net use command syntax:




net use [{DEVICE | *}] [\\COMPUTER\SHARE[\VOL]] [{PASSWORD | *}]] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [{/DELETE | /PERSISTENT:{yes | no}}]


net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]


net use [/PERSISTENT:{yes | no}]










Net use command parameters:



DEVICE : Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (that is, D: through Z:) and printers (that is, LPT1: through LPT3:). Type an asterisk (*) instead of a specific device name to assign the next available device name.


\\COMPUTER\SHARE : Specifies the name of the server and the shared resource. If COMPUTER contains spaces, use quotation marks around the entire computer name from the double backslash (\\) to the end of the computer name (for example, "\\Computer Name\Share Name"). The computer name can be from 1 to 15 characters long.


\VOL : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and running to connect to NetWare servers.


PASSWORD : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.


/USER : Specifies a different user name with which the connection is made.


DOMAIN : Specifies another domain. If you omit DOMAIN, net use uses the current logged on domain.


USER : Specifies the user name with which to log on.


DOTTEDDOMAIN : Specifies the fully-qualified domain name for the domain where the user account exists.


/SAVECRED : Stores the provided credentials for reuse.


/SMARTCARD : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards are available, you are asked to specify the credential.


/DELETE : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.


/PERSISTENT:{yes | no} : Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next logon. No does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use /DELETE to remove persistent connections.


/HOME : Connects a user to the home directory.


net help command : Displays help for the specified net command.











Net use command Remarks:



Connecting and disconnecting from a network resource


Use net use to connect to and disconnect from a network resource, and to view your current connections to network resources. You cannot disconnect from a shared directory if you use it as your current drive or an active process is using it.


=> Viewing connection information


To view information about a connection, you can do either of the following:


=> Type net use DEVICE to get information about a specific connection.


=> Type net use to get a list of all the computer's connections.


=> Using deviceless connections


Deviceless connections are not persistent.


=> Connecting to NetWare servers


After you install and run Client Service for NetWare, you can connect to a NetWare server on a Novell network. Use the same syntax that you use to connect to a Windows Networking server, except you must include the volume you to which you want to connect.


=> Using quotation marks


If the ServerName that you supply contains spaces, use quotation marks around the text (that is, "SERVER"). If you omit quotation marks, an error message appears.


How Authentication Works for Net Use Command



When you use the NET USE command to connect to a share on a server in a domain, the following authentication process verifications take place:

=> If the client's user name is in the domain's UAS account database, the passwords are compared. If the passwords match, access is allowed to the share. If the passwords do not match, an access denied message is returned.


The behavior allows for backward compatibility with Windows for Workgroups and other clients. These clients do not pass the domain name to the Server.

=> If the client's user name does not match a user name in the domain's UAS, the domain controller checks to see if the client's domain is listed in its trust list. If the client's domain name is on the target domain's trust list, the domain controller communicates with the other domain to see if the client's user account and password are valid. If so, access is allowed to the share. If not, an access denied message is returned.

Net Use Command examples



To assign the disk-drive device name E: to the Letters shared directory on the \\Fin server, type:


net use e: \\fin\letters


To assign (map) the disk-drive device name M: to the directory Mike within the Letters volume on the \\Fin NetWare server, type:


net use m: \\fin\letters\mike


To connect the user identifier Dan as if the connection were made from the Accounts domain, type:


net use d:\\server\share /USER:Accounts\Dan


To disconnect from the \\Fin\Public directory, type:


net use f: \\fin\public /DELETE


To connect to the resource memos shared on the \\Fin 3 server, type:


net use k: "\\fin 3" \memos


To restore the current connections at each logon, regardless of future changes, type:


net use /PERSISTENT:yes


net use \\192.168.100.2 /delete




REFERENCES
http://www.maxi-pedia.com/NET+USE+command
http://www.cezeo.com/tips-and-tricks/net-use-command/

Tuesday, October 26, 2010

Troubleshooting Memory and Networking Issues

SkyHi @ Tuesday, October 26, 2010
Many common issues with Linodes are caused by excessive memory consumption or networking configuration errors. This guide provides suggestions for alleviating these problems.

Diagnosing and Fixing Memory Issues Link

When your VPS is running low on physical memory, it may start to "swap thrash." This means it's attempting to use your swap partition heavily instead of real RAM. We recommend you limit your swap partition size to 256 MB; heavy use of swap in a virtualized environment will cause major performance problems.
We strongly recommend running the 32-bit version of your distribution of choice, unless you have a specific reason to run the 64-bit version. The 32-bit version of your distro will use significantly less memory.

Determining Free Memory and Swap Activity Link

You can use the following command to display memory use on your Linode:
free -m
You can use the following snippet to see a list of your running processes sorted by memory use:
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | less
To see IO activity on your VPS, you may use the following command (you may need to install the sysstat package under Debian or Ubuntu first):
iostat -d -x 2 5
This will give an extended device utilization report five times at two second intervals. If your VPS is OOMing (running out of memory), Apache, MySQL, and SpamAssassin are the usual suspects.

MySQL Low-Memory Settings Link

In your MySQL configuration file (typically found in /etc/mysql/my.cnf), change your entries for the various settings shown below to match the recommended values:
key_buffer = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer = 64K
net_buffer_length = 2K
If you don't use InnoDB tables, you should disable InnoDB support by adding the following line:
skip-innodb

Apache 2 Low-Memory Settings Link

Determine the type of MPM in use by your Apache install by issuing the following command. This will tell you which section to edit in your Apache configuration file.
Debian-based systems:
apache2 -V | grep 'MPM'
Fedora/CentOS systems:
httpd -V | grep 'MPM'
In your Apache 2 configuration file (typically found at /etc/apache2/apache2.conf in Debian and Ubuntu systems, and /etc/httpd/httpd.conf in CentOS and other similar systems), change your entries for the various settings shown below to match the recommended values.
StartServers 1
MinSpareServers 3
MaxSpareServers 6
ServerLimit 24
MaxClients 24
MaxRequestsPerChild 3000

Reducing SpamAssassin Memory Consumption Link

If you're filtering mail through SpamAssassin in standalone mode and running into load issues, you'll need to investigate switching to something to keep the program persistent in memory as a daemon. We suggest looking at amavisd-newExternal Link.

Troubleshooting Network Issues Link

If you've added multiple IP addresses to your Linode, you must set up static networking as described in the Linux Static Networking Guide. Please be sure to specify only one gateway. Using multiple gateways frequently causes problems.
If you just added an IP address to your Linode, please be sure to reboot before attempting to use it. This is required to properly route the IP address on our network.
If you've added a private IP address, please be sure to use the network settings shown in the Network tab of the Linode Manager, paying special attention to the subnet mask. Note that private IP addresses do not require a gateway (nor should one be specified).

REFERENCES
http://library.linode.com/troubleshooting/memory-networking

PHP Security Guide

SkyHi @ Tuesday, October 26, 2010
http://php.robm.me.uk/
http://ca3.php.net/manual/en/function.addslashes.php
http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string
http://www.sitepoint.com/forums/showthread.php?t=337881

Monday, October 25, 2010

Outlook Send/Receive errors

SkyHi @ Monday, October 25, 2010
Nothing is more annoying than not being able to get your email when you want it and be presented with a sometimes very cryptic or a seeming meaningless error code instead. Although there are a multitude of error codes that you could be presented with, there are a couple of common solutions that work for many cases.
Aside from offering common solutions, this guide also contains a list of send/receive error codes which you may encounter and their meaning. For certain error codes, a more specific solution is mentioned.

Check your email account settings.

If you just configured your mail account and are directly presented with a send/receive error, you should start with verifying if your account settings are correct. You can get this information from your ISP or email administrator. Settings for several large free email providers can be found here.
When you are trying to send a message from another network than the network where the mailbox is located (for instance, from a hotel or a wifi hotspot, then you need to enable authentication for the configured SMTP server as well.
When Outlook worked before and you're suddenly presented with send/receive errors, it is still good practice to verify your account settings and make sure that they are current. For example, several ISPs have increased their email security settings which could require you to enable SSL or make port changes. Also, sometimes they have merged with other ISPs and decommission the old account settings over time requiring you to make changes.
Trying your account settings on another computer or creating an additional mail profile for testing could help you determining if it is an issue with your current account configuration settings.

Disable virus scanner integration.

Virus scanners which integrates themselves with Outlook are a known source of causing all sorts of send receive issues. For instance, the following time-out issues are often a result of this;
-The operation timed out waiting for a response from the receiving (POP) server 
-A time-out occurred while communicating with the server
Other issues that are often caused by having a virus scanner integrated with Outlook are;
-Outlook being very slow in collecting your email
-Messages ending up stuck in your Outbox (also see below)
-Messages being sent but never received
-Sending or receiving blank messages
-General message corruption
Disabling your virus scanner's integration with Outlook does not compromise your security as you'd still be sufficiently protected by the on-access scanner part of the virus scanner. For more details see; Disable virus scanner integration?

Check your firewall settings.

Firewalls can block incoming and outgoing traffic so make sure that Outlook and/or the required ports for email are listed as an exception to go through.
If you are presented with send/receive errors after updating Outlook, you probably need to reconfigure your firewall to re-allow Outlook to pass-through again. This is because several firewall solutions (such as ZoneAlarm) verify via a hash that it is indeed the correct outlook.exe that is trying to pass through the firewall and not some virus which named itself outlook.exe. Since with some updates the outlook.exe gets updated as well, you'll need to accept it as safe again. You can find more information about this in the manual of your firewall solution.

Issues with add-ins

Aside from virus scanners, there could be other add-ins installed which integrate itself with the send/receive process of Outlook. Loading Outlook in Safe Mode is a good first step to see if add-ins are indeed the cause of the issues.
To further troubleshoot add-ins, manually disable each of them and re-enable them one-by-one to find the culprit.

Check data store integrity

If there are issues with the delivery location (your Outlook mailbox), then this could result in send/receive issues. Checking the integrity of your delivery location can be done with scanpst.exe or scanost.exe (depending on your mail account type). In some cases you'll need to run thepst2gb tool when the data store is full.
If you are using an Exchange account, then you could also try it with Cached Exchange Mode disabled and see if it works correctly now. If it does, rename the ost-file to .old and have Outlook rebuild the ost-file or verify that the configured location for the ost-file in your account settings is valid. 

Stuck message or hidden read receipt

A stuck message is also often a source of having send/receive issues. While it is easy enough to spot a message stuck in your Outbox, in some cases the stuck message can be a Read Receipt which are hidden messages and thus much harder to recognize as the issues and to delete.

Other send/receive issues

Below is a short list of other common send/receive issues which you could encounter but which are not directly identified by a send/receive error.
  • Password prompts
    In some cases Outlook can not remember your password for your mail account which results in being prompted for it.
  • Receiving duplicates
    When you receive multiple copies of a message or receiving the same message(s) over and over again see this guide.
  • Rules not being processed automatically
    When you have rules configured but they are not executed automatically when you receive new emails, see this guide.
  • No automatic send/receive upon starting Outlook or cannot edit Send/Receive settings.
    In those cases, reset your srs-file by renaming it to .old.

Send/Receive error codes

Searching in the error list below probably goes best with the Find function of your browser. For most browsers the keyboard shortcut for the Find function is CTRL+F.
When typing in the error code, please note that the error code starts with the digit 0 and not with the letter O.
General Errors
Error CodeDescriptionError Type
0x800CCC00Authentication did not loadLOAD_SICILY_FAILED
0x800CCC01Invalid certificate contentINVALID_CERT_CN
0x800CCC02Invalid certificate date.INVALID_CERT_DATE
0x800CCC03User already connected.ALREADY_CONNECTED
0x800CCC04-CONN
0x800CCC05Not connected to server.NOT_CONNECTED
0x800CCC06-CONN_SEND
0x800CCC07-WOULD_BLOCK
0x800CCC08-INVALID_STATE
0x800CCC09-CONN_RECV
0x800CCC0AMessage download incompleteINCOMPLETE
0x800CCC0BServer or maildrop is busy.BUSY
0x800CCC0C-NOT_INIT
0x800CCC0DCannot locate server.CANT_FIND_HOST
0x800CCC0ECannot connect to server.FAILED_TO_CONNECT
0x800CCC0FConnection closed.CONNECTION_DROPPED
0x800CCC10Address not known on server.INVALID_ADDRESS
0x800CCC11Mailing list not known on serverINVALID_ADDRESS_LIST
0x800CCC12Unable to send Winsock request.SOCKET_READ_ERROR
0x800CCC13Unable to read Winsock replySOCKET_WRITE_ERROR
0x800CCC14Unable to initialize Winsock.SOCKET_INIT_ERROR
0x800CCC15Unable to open Windows SocketSOCKET_CONNECT_ERROR
0x800CCC16User account not recognized.INVALID_ACCOUNT
0x800CCC17User canceled operationUSER_CANCEL
0x800CCC18Logon attempt failed.SICILY_LOGON_FAILED
0x800CCC19A time-out occurred while communicating with the serverTIMEOUT
0x800CCC1AUnable to connect using SSL.SECURE_CONNECT_FAILED
Winsock Errors
Error CodeDescriptionError Type
0x800CCC40Network subsystem is unusable.WINSOCK_WSASYSNOTREADY
0x800CCC41Windows Sockets cannot support this application.WINSOCK_WSAVERNOTSUPPORTED
0x800CCC42-WINSOCK_WSAEPROCLIM
0x800CCC43Bad address.WINSOCK_WSAEFAULT
0x800CCC44Unable to load Windows Sockets.WINSOCK_FAILED_WSASTARTUP
0x800CCC45Operation now in progress. This error appears if a Windows Sockets API is called while a blocking function is in progress.WINSOCK_WSAEINPROGRESS
SMTP Errors
Error CodeDescriptionError Type
0x800CCC60Invalid response.SMTP_RESPONSE_ERROR
0x800CCC61Unknown error code.SMTP_UNKNOWN_RESPONSE_CODE
0x800CCC62Syntax error returned.SMTP_500_SYNTAX_ERROR
0x800CCC63Parameter syntax incorrect.SMTP_501_PARAM_SYNTAX
0x800CCC64Command not implemented.SMTP_502_COMMAND_NOTIMPL
0x800CCC65Improper command sequence.SMTP_503_COMMAND_SEQ
0x800CCC66Command not implemented.MTP_504_COMMAND_PARAM_NOTIMPL
0x800CCC67Command not available.SMTP_421_NOT_AVAILABLE
0x800CCC68Mailbox is locked and busy.SMTP_450_MAILBOX_BUSY
0x800CCC69Mailbox not found.SMTP_550_MAILBOX_NOT_FOUND
0x800CCC6AError processing request.SMTP_451_ERROR_PROCESSING
0x800CCC6BUser mailbox is known but mailbox not on this server.SMTP_551_USER_NOT_LOCAL
0x800CCC6CNo space to store messages.SMTP_452_NO_SYSTEM_STORAGE
0x800CCC6DStorage limit exceeded.SMTP_552_STORAGE_OVERFLOW
0x800CCC6EInvalid mailbox name syntax.SMTP_553_MAILBOX_NAME_SYNTAX
0x800CCC6FTransaction failed.SMTP_554_TRANSACT_FAILED
0x800CCC78Unknown sender. This is caused by having the incorrect e-mail address in the Reply-To field.SMTP_REJECTED_SENDER
0x800CCC79Server rejected recipients.SMTP_REJECTED_RECIPIENTS
0x800CCC7ANo sender address specified.SMTP_NO_SENDER
0x800CCC7BNo recipients specified.SMTP_NO_RECIPIENTS
POP3 Errors
Error CodeDescriptionError Type
0x800420CBMail cannot be stored on server.POP3_NO_STORE
0x800CCC90Client response invalid.POP3_RESPONSE_ERROR
0x800CCC91Invalid user name or user not found.POP3_INVALID_USER_NAME
0x800CCC92Password not valid for account.POP3_INVALID_PASSWORD
0x800CCC93Unable to interpret response.POP3_PARSE_FAILURE
0x800CCC94STAT Command required.POP3_NEED_STAT
0x800CCC95No messages on server.POP3_NO_MESSAGES
0x800CCC96No messages marked for retrieval.POP3_NO_MARKED_MESSAGES
0x800CCC97Message ID out of range.POP3_POPID_OUT_OF_RANGE
IMAP Errors
Error CodeDescriptionError Type
0x800CCCD1Login failed.IMAP_LOGINFAILURE
0x800CCCD2Message tagged.IMAP_TAGGED_NO_RESPONSE
0x800CCCD3Invalid response to request.IMAP_BAD_RESPONSE
0x800CCCD4Syntax error.IMAP_SVR_SYNTAXERR
0x800CCCD5Not an IMAP server.IMAP_NOTIMAPSERVER
0x800CCCD6Buffer limit exceeded.IMAP_BUFFER_OVERFLOW
0x800CCCD7Recovery error.IMAP_RECVR_ERROR
0x800CCCD8Incomplete data.IMAP_INCOMPLETE_LINE
0x800CCCD9Connection not allowed.IMAP_CONNECTION_REFUSED
0x800CCCDAUnknown response.IMAP_UNRECOGNIZED_RESP
0x800CCCDBUser ID has changed.IMAP_CHANGEDUID
0x800CCCDCUser ID command failed.IMAP_UIDORDER
0x800CCCDDUnexpected disconnect.IMAP_UNSOLICITED_BYE
0x800CCCDEInvalid server state.IMAP_IMPROPER_SVRSTATE
0x800CCCDFUnable to authorize client.IMAP_AUTH_NOT_POSSIBLE
0x800CCCE0No more authorization types.IMAP_OUT_OF_AUTH_METHODS
NNTP (News Server) Errors
Error CodeDescriptionError Type
0x800CCCA0News server response error.NNTP_RESPONSE_ERROR
0x800CCCA1Newsgroup access failed.NNTP_NEWGROUPS_FAILED
0x800CCCA2LIST command to server failed.NNTP_LIST_FAILED
0x800CCCA3Unable to display list.NNTP_LISTGROUP_FAILED
0x800CCCA4Unable to open group.NNTP_GROUP_FAILED
0x800CCCA5Group not on server.NNTP_GROUP_NOTFOUND
0x800CCCA6Message not on server.NNTP_ARTICLE_FAILED
0x800CCCA7Message header not found.NNTP_HEAD_FAILED
0x800CCCA8Message body not found.NNTP_BODY_FAILED
0x800CCCA9Unable to post to server.NNTP_POST_FAILED
0x800CCCAAUnable to post to server.NNTP_NEXT_FAILED
0x800CCCABUnable to display date.NNTP_DATE_FAILED
0x800CCCACUnable to display headers.NNTP_HEADERS_FAILED
0x800CCCADUnable to display MIME headers.NNTP_XHDR_FAILED
0x800CCCAEInvalid user or password.NNTP_INVALID_USERPASS
RAS (Remote Access) Errors
Error CodeDescriptionError Type
0x800CCCC2RAS/DUN not installed.RAS_NOT_INSTALLED
0x800CCCC3RAS/DUN process not found.RAS_PROCS_NOT_FOUND
0x800CCCC4RAS/DUN error returned.RAS_ERROR
0x800CCCC5Connectoid damaged or missing.RAS_INVALID_CONNECTOID
0x800CCCC6Error getting dial settings.RAS_GET_DIAL_PARAMS

Enhanced Mail System Status Codes

Aside from getting the reported errors, there usually also is another error code listed. These error codes consist of 3 digits which could be separated by a dot. For instance; 553 or 5.5.3
These errors could also be sent to you in an email (usually from System Administrator) with a Delivery Status Notification code in it.
The first number will tell you the general status of the message;
  • 2
    Success. The message has been delivered.
  • 4
    Persistent Transient Failure. This means that the message was valid and accepted by the server but there is a temporary problem which prevents it from being delivered. The mail server will usually try to send it again later until a time out is reached. Until you get the a message that the server is giving up (see "5" below), there is no direct need to resend the message.
  • 5
    Permanent. This is a fatal error and the message sent cannot be delivered. It's unlikely that the message can be delivered by a simple resend. A change must be made either within the message (wrong address, too big, too many recipients, etc), within the account settings or at the mail server of the sender or receiver.
The second 2 numbers will give you more details about why the message is delayed or failed;
  • X.0.0   Other undefined Status
  • X.1.0 Other address status
  • X.1.1 Bad destination mailbox address
  • X.2.0 Bad destination system address
  • X.1.3 Bad destination mailbox address syntax
  • X.1.4 Destination mailbox address ambiguous
  • X.1.5 Destination mailbox address valid
  • X.1.6 Mailbox has moved
  • X.1.7 Bad sender's mailbox address syntax
  • X.1.8 Bad sender's system address
  • X.1.9 Message relayed to non-compliant mailer
  • X.2.0 Other or undefined mailbox status
  • X.2.1 Mailbox disabled, not accepting messages
  • X.2.2 Mailbox full
  • X.2.3 Message length exceeds administrative limit.
  • X.2.4 Mailing list expansion problem
  • X.3.0 Other or undefined mail system status
  • X.3.1 Mail system full
  • X.3.2 System not accepting network messages
  • X.3.3 System not capable of selected features
  • X.3.4 Message too big for system
  • X.3.5 System incorrectly configured
  • X.4.0 Other or undefined network or routing status
  • X.4.1 No answer from host
  • X.4.2 Bad connection
  • X.4.3 Routing server failure
  • X.4.4 Unable to route
  • X.4.5 Network congestion
  • X.4.6 Routing loop detected
  • X.4.7 Delivery time expired
  • X.5.0 Other or undefined protocol status
  • X.5.1 Invalid command
  • X.5.2 Syntax error
  • X.5.3 Too many recipients
  • X.5.4 Invalid command arguments
  • X.5.5 Wrong protocol version
  • X.5.6 Authentication Exchange line is too long
  • X.6.0 Other or undefined media error/bad content
  • X.6.1 Media not supported
  • X.6.2 Conversion required and prohibited/bad domain or alias
  • X.6.3 Conversion required but not supported
  • X.6.4 Conversion with loss performed
  • X.6.5 Conversion failed
  • X.6.6 Message content not available
  • X.7.0 Other or undefined security status/authentication failure/violating site policy
  • X.7.1 Delivery not authorized, message refused
  • X.7.2 Mailing list expansion prohibited
  • X.7.3 Security conversion required but not possible
  • X.7.4 Security features not supported
  • X.7.5 Cryptographic failure
  • X.7.6 Cryptographic algorithm not supported
  • X.7.7 Message integrity failure
  • X.7.8 Trust relationship required/Authentication credentials invalid
  • X.7.9  Authentication mechanism is too weak
  • X.7.10 Encryption Needed
  • X.7.11 Encryption required for requested authentication mechanism
  • X.7.12 A password transition is needed
  • X.7.13 User Account Disabled
  • X.7.14 Trust relationship required
  • X.7.15 Authentication credentials invalid
  • X.7.16 Future release per-user message quota exceeded
  • X.7.17 Future release system message quota exceeded
Common combinations are;
421 or 4.2.1Service not available, the connection will be closed (the server could be about to be restarted)
450 or 4.5.0Requested action failed: mailbox unavailable (for instance, the mailbox is busy or locked)
451 or 4.5.1Requested action aborted due to an error on the server (contact your ISP)
452 or 4.5.2Requested action not taken due to insufficient system storage on the server (contact your ISP)
453 or 4.5.3Requested action not taken due to policy settings (for instance, too many recipients specified)
500 or 5.0.0Syntax error, command unrecognized (This may include errors such as command line too long)
501 or 5.0.1Syntax error in parameters or arguments
502 or 5.0.2Command not implemented
503 or 5.0.3Bad sequence of commands
504 or 5.0.4Command parameter not implemented (for instance, Helo command rejected: need fully-qualified hostname)
550 or 5.5.0Requested action not taken: mailbox unavailable (for instance, mailbox not found, no access due to policy reasons)
551 or 5.5.1User not local and an issue occurred when the server tried to forward the message.
552 or 5.5.2Requested mail action aborted: exceeded storage allocation
553 or 5.5.3Requested action not taken: mailbox name not allowed for instance, the mailbox name is invalid)
554 or 5.5.4Transaction failed
More details about the individual error codes can be found within the base RFC document and its listed updates at the top.

Other error codes

Aside from the above listed error codes, there are many more error codes which you could encounter during send/receive. These usually refer to internal errors from Outlook, are specific to a certain mail server or are actually coming from your virus scanner or another add-in that integrates with your send/receive or networking process.
Due to the nature and origins of these error codes, the list above will probably always remain incomplete. If you encounter a new send/receive error, have a better description or even a solution for it, please email it to me (preferably with a screenshot of the error attached) and I'll update the list accordingly.
Error CodeDescriptionCause/Possible solution
0x0004b9  
0×000501  
0×80000003  
0×80004001Not implemented 
0×80004005The operation failedVirus scanner integration issue usually related to script blocking.
0x800300FDUnknown ErrorIndicates that there is insufficient space in the Temp folder
-Empty your Deleted Items folder
-Empty your Temp folder; C:\Windows\Temp
0×80040109The Operation cannot be performed because the message has been changedVirus scanner integration issue.
Some add-inmay have altered the message upon sending.
0x8004010FMicrosoft Exchange offline address book.
Not downloading Offline address book files. A server (URL) could not be located.
Verify the publication address for the Offline Address Book (OAB) in Exchange.
0×80040115The connection to the Microsoft Exchange server is unavailable. Outlook must be online or connected to complete this action.The server is not reachable, check your connection and verify that Outlook is in on-line mode.
This issue could also occur with other mail servers, not just Exchange.
0×80040119An unknown error has occurred.
Messaging interface has caused an unknown error.
Virus scanner integration issue usually related to authentication.
This issue could also occur when there are errors in your pst-file.
0x8004011DTask “Microsoft Exchange Server” reported error (0×8004011D): “The server is not available. Contact your administrator if this condition persists.”The server is not reachable, check your connection and verify that Outlook is in on-line mode.
This issue could also occur with other mail servers, not just Exchange.
0×80040126The operation cannot be performed because the connection to the server is offline.This issue is an Outlook Connector issue. If there is no general issues with Hotmail itself, make sure you have the latest version installed. Removing and re-adding your Hotmail account might help.
0×80040305Your server administrator has limited the number of items you can open simultaneously.
Email too big (Google Apps Sync)
These limitations can be set on the mail server. Contact your mail admin to find out which limitations are in affect.
0×80040600An unknown error has occurred.Virus scanner integration issue usually related to authentication.
This issue could also occur when there are errors in your pst-file.
0×80040607An unknown error occurredVirus scanner integration issue.
Authentication not enabled for the configured SMTP server.
0x8004060CUnknown Error 
0×80040900  
0x80040FB3Error encountered. Check documentation.This issue is related to BlackBerry accounts. It appears that your account is not associated with a BES or Exchange account.
Other causes could be a corrupted item that is trying to be synched. Remove this item and try again.
0×80042108Outlook is unable to connect to your incoming (POP) e-mail server.
If you continue to receive this message, contact your server administrator or ISP.
 
0×80042109Outlook cannot connect to your outgoing (SMTP) e-mail server.
If you continue to receive this message, contact your server administrator or ISP.
 
0x8004210AThe operation timed out waiting for a response from the receiving (POP) server.
If you continue to receive this message, contact your server administrator or Internet service provider (ISP).
Virus scanner integration issue
0x8004210BThe operation timed out waiting for a response from the sending (SMTP) server.
If you continue to receive this message, contact your server administrator or Internet service provider (ISP).
An address in the distribution list might be malformed or corrupted.
Update/remove the address or recreate the distribution list.
0×80042112  
0×8004218  
0×80048002This task was cancelled before it was completed.Virus scanner integration issue.
Some add-inmay have altered the message upon sending.
0x8004DF0B  
0×80070005You don't have appropriate permissions to perform this operationRefers to issues with the delivery location;
-scan it for errors with scanpst.exe or scanost.exe
-verify that you have read/write permissions on the pst-/ost-file
-verify that the path to the pst-/ost-file is valid
-verify that the ost-file belongs to the correct user and mailbox
0x8007000E  
0×80070021  
0×80070057Could not complete operation. One or more parameter values are not valid.
Sending reported error parameters not correct.
Virus scanner integration issue.
This error could also occur with Google Apps Sync trying to sync your RSS folders to the server.
0x80072F17Synchronization could not be completed. Try again later.This issue is usually caused by issues with the SSL certificate.
0x8007007EUnknown error 
0x80090FB3  
0x800C0131Unknown error has occurred.data storage issue
0x800C0133 data storage issue
virus scanner integration issue
0x800C013B  
0x800CCC33Task 'Hotmail: Folder:Inbox Synchronizing headers.' reported error (0×800CCC33) : 'Access to the account was denied. Verify that your username and password are correct. The server responded 'Forbidden'.This error is encountered when you are trying to make a connection to a Live Hotmail account without the Outlook Connector installed.
0x800CCC7DUnknown ErrorThe outgoing SMTP server does not support secure connections.
Verify your account settings or contact your ISP.
0x800CCC80None of the authentication methods supported by this client are supported by your server. 
0x800CCCF7  
0x81FC0005 Close and reopen Outlook
0×834005  
0xC0000005  
0xD4904005  

Related Posts or Add-ins