A
A
ahristovsky2016-01-08 16:03:26
gmail
ahristovsky, 2016-01-08 16:03:26

Is it possible to send a message from gmail using curl?

Is it possible to log into gmail without popping up different confirmation windows using username and password? And then send a message. It is most convenient for me to do this through get, I read it on the official website - it seems impossible ... What do you say?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2016-01-08
@dimonchik2013

in which official read?
in this https://developers.google.com/gmail/api/?hl=en you can

D
Daniel Khaliulin, 2016-01-08
@khaliulin

Yes, you can work with the Google mail server via SMTP .
There was an experience of using PHPMailer , it just works on curls.
Sending an email is quite simple:

require 'PHPMailer-master/PHPMailerAutoload.php';
  $mail = new PHPMailer;
  $mail->CharSet = "utf-8";                          
  $mail->isSMTP();                                      
  $mail->Host = 'smtp.gmail.com';  
  $mail->SMTPAuth = true;                               
  $mail->Username = 'XX';	 // Почта пользователя, от имени которой будут отправляться письма.
  $mail->Password = 'secret'; // Пароль от почты пользователя, от имени которой будут отправляться письма.    
  $mail->SMTPSecure = 'ssl';                            
  $mail->Port = 465;                                    
  $mail->addAddress('YY');	// Почта пользователя, которому будут отправляться письма.   
  $mail->isHTML(true);                                  					
  $subj = "Тема";		// Тема письма
  $mail->Subject = $subj;
  $mail->Body    = "Тут_ваш_хтмл";
  if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
  } else {
    return true;
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question