Normally the IV data is prefixed to the ciphertext. For CBC it is always the same size as the block size, so if the other party doesn't have mcrypt_get_iv_size
it should not pose a problem.
Note that to create a secure email more is needed than just encryption; at least add a HMAC over the IV and ciphertext. Calling srand
should be avoided as the random number generator should already be seeded. Furthermore that example is not using AES, use MCRYPT_RIJNDAEL_128
instead. Just a hash over a password is not a good Password Based Key Derivation Function.
For binary data you may want to take a look at the SMIME or PGP specifications. If you want to store everything in the message body, you need to at least base64 encode the IV, ciphertext and hopefully the authentication tag created using HMAC.
For an example that uses AES & CBC + prefixes the IV, just take a look at the mcrypt_encrypt
sample code that I rewrote.