<p>In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?</p>

[{'answer_id': 36086, 'author': 'maxsilver', 'author_id': 1477, 'author_profile': 'https://Stackoverflow.com/users/1477', 'pm_score': 2, 'selected': False, 'text': '<p>You could use PEAR\'s mail function with Gmail\'s SMTP Server</p>\n\n<p>Note that when sending e-mail using Gmail\'s SMTP server, it will look like it came from your Gmail address, despite what you value is for $from.</p>\n\n<p>(following code taken from <a href="http://email.about.com/od/emailprogrammingtips/qt/et073006.htm" rel="nofollow noreferrer">About.com Programming Tips</a> )</p>\n\n<pre><code>&lt;?php\nrequire_once "Mail.php";\n\n$from = "Sandra Sender &lt;sender@example.com&gt;";\n$to = "Ramona Recipient &lt;recipient@example.com&gt;";\n$subject = "Hi!";\n$body = "Hi,\\n\\nHow are you?";\n\n// stick your GMAIL SMTP info here! ------------------------------\n$host = "mail.example.com";\n$username = "smtp_username";\n$password = "smtp_password";\n// --------------------------------------------------------------\n\n$headers = array (\'From\' =&gt; $from,\n  \'To\' =&gt; $to,\n  \'Subject\' =&gt; $subject);\n$smtp = Mail::factory(\'smtp\',\n  array (\'host\' =&gt; $host,\n    \'auth\' =&gt; true,\n    \'username\' =&gt; $username,\n    \'password\' =&gt; $password));\n\n$mail = $smtp-&gt;send($to, $headers, $body);\n\nif (PEAR::isError($mail)) {\n  echo("&lt;p&gt;" . $mail-&gt;getMessage() . "&lt;/p&gt;");\n } else {\n  echo("&lt;p&gt;Message successfully sent!&lt;/p&gt;");\n }\n?&gt;\n</code></pre>\n'}, {'answer_id': 36279, 'author': 'Javache', 'author_id': 1074, 'author_profile': 'https://Stackoverflow.com/users/1074', 'pm_score': 4, 'selected': True, 'text': '<p>Gmail\'s SMTP-server requires a very specific configuration.</p>\n\n<p>From <a href="http://mail.google.com/support/bin/answer.py?answer=13287" rel="noreferrer">Gmail help</a>:</p>\n\n<pre><code>Outgoing Mail (SMTP) Server (requires TLS)\n - smtp.gmail.com\n - Use Authentication: Yes\n - Use STARTTLS: Yes (some clients call this SSL)\n - Port: 465 or 587\nAccount Name:   your full email address (including @gmail.com)\nEmail Address:  your email address (username@gmail.com)\nPassword:     your Gmail password \n</code></pre>\n\n<p>You can probably set these settings up in <a href="http://pear.php.net/package/Mail" rel="noreferrer">Pear::Mail</a> or <a href="http://phpmailer.codeworxtech.com/" rel="noreferrer">PHPMailer</a>. Check out their documentation for more details.</p>\n'}]
['https://Stackoverflow.com/questions/36079', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/356/']