Using php’s swiftmailer with gmail

Don’t mean to resurrect an old post, but just in case others are looking for the answer, and because this post came up during my search for a solution despite the age. When using PHP SwiftMailer to connect to Gmail or Google Apps email accounts you need to use the following $transporter = Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, … Read more

XAMPP Sendmail using Gmail account

This is what worked for me Hopefully no one else will burn oil to figure this out like i did. Here is my sendmail.ini [sendmail] smtp_server=smtp.gmail.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log [email protected] auth_password=yourgmailpassword [email protected] php/php.ini —-basically comment everything out except sendmail_path & mail.add_x_header [mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = localhost ; http://php.net/smtp-port ;smtp_port … Read more

Net::SMTPAuthenticationError when sending email from Rails app (on staging environment)

I had the same problem: emails were sent from development, but not from production (where I was getting Net::SMTPAuthenticationError). This drove me to conclusion that the problem was not with my app’s configuration, but with Google. Reason: Google was blocking access from unknown location (app in production) Solution: Go to http://www.google.com/accounts/DisplayUnlockCaptcha and click continue (this … Read more

Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?

$mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure=”ssl”; // secure transfer enabled REQUIRED for Gmail $mail->Host = “smtp.gmail.com”; $mail->Port = 465; // or 587 $mail->IsHTML(true); $mail->Username = “[email protected]”; $mail->Password … Read more

How to to send mail using gmail in Laravel?

first login to your gmail account and under My account > Sign In And Security > Sign In to google, enable two step verification, then you can generate app password, and you can use that app password in .env file. Your .env file will then look something like this MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=apppassword MAIL_ENCRYPTION=tls … Read more

How can I send an email by Java application using GMail, Yahoo, or Hotmail?

First download the JavaMail API and make sure the relevant jar files are in your classpath. Here’s a full working example using GMail. import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class Main { private static String USER_NAME = “*****”; // GMail user name (just the part before “@gmail.com”) private static String PASSWORD = “********”; // … Read more

How to send an email with Gmail as provider using Python?

def send_email(user, pwd, recipient, subject, body): import smtplib FROM = user TO = recipient if isinstance(recipient, list) else [recipient] SUBJECT = subject TEXT = body # Prepare actual message message = “””From: %s\nTo: %s\nSubject: %s\n\n%s “”” % (FROM, “, “.join(TO), SUBJECT, TEXT) try: server = smtplib.SMTP(“smtp.gmail.com”, 587) server.ehlo() server.starttls() server.login(user, pwd) server.sendmail(FROM, TO, message) server.close() … Read more