How to send mail using PHP?

You have several options: there’s built in mail function, but it requires that some MTA is running on the machine, doesn’t support authentication, and you’ll need to work hard to send attachments there’s Pear Mail package, if you like to use Pear stuff there’s a good PHPMailer class which I used in past few years … Read more

Responsive order confirmation emails for mobile devices?

How about something like this? This uses a fluid/liquid technique that works on all major clients, including those that do not support media queries (Gmail etc…): <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> <html><head><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title></title> <style type=”text/css”> #outlook a {padding:0;} body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */ .ExternalClass … Read more

Running VBA from a HYPERLINK()

To run the function only on a click you can try entering as a subaddress: =HYPERLINK(“#generateEmail(H2, I2, M2)”, “Generate Email”) and then add an extra line in the code to return the current address: Function generateEmail(name, manager, cc) Set generateEmail = Selection ‘Paste Outlook Code Here End Function Note this method does not get executed … Read more

send email with attachment using php

for what reason no use phpmailer? example for an attachment: function mandaMail ($nombredest, $maildest, $asunto, $cuerpo) { require_once(“mailer/class.phpmailer.php”); $mail = new PHPMailer(true); $mail->IsSMTP(); try { $mail->Host = “xxxx”; $mail->Port = 25; // smtp server $mail->SMTPAuth = true; $mail->Username = “xxxx”; // smtp username $mail->Password = “xxxx”; // smtp pass $mail->AddReplyTo(“xxxx”, “xxxx”); // email & name … Read more

Sending mail error with python smtplib

The following works for microsoft, google, yahoo accounts on Python 2.7 and Python 3.2: #!/usr/bin/env python # -*- coding: utf-8 -*- “””Send email via smtp_host.””” import smtplib from email.mime.text import MIMEText from email.header import Header ####smtp_host=”smtp.live.com” # microsoft ####smtp_host=”smtp.gmail.com” # google smtp_host=”smtp.mail.yahoo.com” # yahoo login, password = … recipients_emails = [login] msg = MIMEText(‘body…’, ‘plain’, … Read more

Proper prevention of mail injection in PHP

To filter valid emails for use in the recipient email field, take a look at filter_var(): $email = filter_var($_POST[‘recipient_email’], FILTER_VALIDATE_EMAIL); if ($email === FALSE) { echo ‘Invalid email’; exit(1); } This will make sure your users only supply singular, valid emails, which you can then pass to the mail() function. As far as I know, … Read more