How to Configure Mac Postfix to Use Gmail for SMTP Relay

If you’re like me and you do your development work on a Mac, you’ll want to configure Postfix to send you email messages. It’s pretty easy to do. vi /etc/postfix/main.cf Edit main.cf and add the following to the end of the file. relayhost=smtp.gmail.com:587 smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd smtp_sasl_security_options=noanonymous smtp_sasl_mechanism_filter=plain smtp_use_tls=yes smtp_tls_security_level=encrypt tls_random_source=dev:/dev/urandom The key one is the How to Configure Mac Postfix to Use Gmail for SMTP Relay

PHP SoapClient Create An Array of Objects

In PHP, you can’t create an array with the same key more than once. You can’t do this. $array[‘transaction’] = “success”; $array[‘transaction’] = “fail”; Obviously, you can DO that, but “fail” will overwrite “success.” But when making Soap calls, it’s often necessary to pass in a structure like this. <users> <user> <firstname>Jamal</firstname> </user> <user> <firstname>Acacia</firstname> PHP SoapClient Create An Array of Objects

Regular Expression to Match Credit Card Expiration Date

I needed to validate a credit card expiration date and this is the regular expression I cobbled together by looking at various sources. /^(0[1-9]|1[0-2])\/|\-?([0-9]{4}|[0-9]{2})$/ It’s nearly identical to a regex in this Stack Overflow discussion. All I did was make it work for 01-2020, as well as, 01/2020.