application/config/email.php
<?php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'tls://smtp.aol.com';
$config['smtp_user'] = 'chris.muench';
$config['smtp_pass'] = 'PASSWORD';
$config['smtp_port'] = '587';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf'] = "\r\n";
?>
E-Mail Debug Statement:
The following SMTP error was encountered: 0
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Fri, 9 Nov 2012 20:39:52 -0500 From: "PHP Point Of Sale, Inc" Return-Path: To: chris.muench#aol.com Subject: =?utf-8?Q?Reset_password?= Reply-To: "admin#phppointofsale.com" X-Sender: admin#phppointofsale.com X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <509db0685db38#phppointofsale.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_509db0685db40" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_509db0685db40 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit You have requested to reset your password, please click the link below in order to complete the password reset process Reset password --B_ALT_509db0685db40 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable You have requested to reset your password, please click the link below in o= rder to complete the password reset process
Note: I am able to send e-mail from a gmail account. What is wrong?
Related
Here is my code:
Here is the response:
2020/09/14 12:19:51.425: INFO Results for adding ppsEmailAddress as recovery email: {data=[object Object], finalURL=https://www.googleapis.com/admin/directory/v1/users/ttestaccount#pps.net, headers={Alt-Svc=h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43", Content-Length=357, Content-Type=application/json; charset=UTF-8, Date=Mon, 14 Sep 2020 19:19:51 GMT, Server=ESF, Vary=[Origin, X-Origin, Referer], X-Content-Type-Options=nosniff, X-Frame-Options=SAMEORIGIN, X-XSS-Protection=0}, initialURL=https://www.googleapis.com/admin/directory/v1/users/ttestaccount#pps.net, statusCode=400.0, statusReason=Bad Request}
Full code:
Trying to follow the Google API reference here, though something wrong with my syntax:
https://developers.google.com/admin-sdk/directory/v1/reference/users#resource
I made a similar request using the Google OAuth Playground
This was the format of my request:
PATCH /admin/directory/v1/users/youremail#joshgoldeneagle.com HTTP/1.1
Host: www.googleapis.com
Content-length: 45
Content-type: application/json
Authorization: Bearer {REPLACE WITH ACCESS TOKEN}
{
recoveryEmail: "yourPatchEmail#joshgoldeneagle.com"
}
Ensure that callGoogleAPI() makes a request in this format.
References:
https://developers.google.com/admin-sdk/directory/v1/reference/users/patch
After I use print debugger to check whether it's sent or not, and here's what I got in return:
bool(false) 220 smtp.gmail.com ESMTP t8sm1776565pgr.21 - gsmtp
hello: 250-smtp.gmail.com at your service, [45.116.123.5]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. t8sm1776565pgr.21 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Date: Fri, 2 Feb 2018 13:02:25 +0530
To: demo#example.com
From: "MyWebsite" <demo#example.com>
Return-Path: <demo#example.com>
Subject: =?UTF-8?Q?How=20to=20send=20email=20vi?==?UTF-8?Q?a=20SMTP=20?= =?UTF-8?Q?server=20in=20CodeIgniter?=
Reply-To: <demo#example.com>
User-Agent: CodeIgniter
X-Sender: demo#example.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5a741409bc741#gmail.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5a741409bc741"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_5a741409bc741
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Sending email via SMTP serverThis email has sent via SMTP server from
CodeIgniter application.
--B_ALT_5a741409bc741
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=3Ch1=3ESending email via SMTP server=3C/h1=3E=3Cp=3EThis email has sent vi=
a SMTP server from CodeIgniter application.=3C/p=3E
--B_ALT_5a741409bc741--
When I changed the smtp_port to 465 and I got in response like
bool(false)
hello: F
The following SMTP error was encountered: F
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Date: Fri, 2 Feb 2018 13:12:43 +0530
To: demo#example.com
From: "MyWebsite" <demo#example.com>
Return-Path: <demo#example.com>
Subject: =?UTF-8?Q?How=20to=20send=20email=20vi?==?UTF-8?Q?a=20SMTP=20?= =?UTF-8?Q?server=20in=20CodeIgniter?=
Reply-To: <demo#example.com>
User-Agent: CodeIgniter
X-Sender: demo#example.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5a7416736d6ea#gmail.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5a7416736d6ea"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_5a7416736d6ea
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Sending email via SMTP serverThis email has sent via SMTP server from
CodeIgniter application.
--B_ALT_5a7416736d6ea
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=3Ch1=3ESending email via SMTP server=3C/h1=3E=3Cp=3EThis email has sent vi=
a SMTP server from CodeIgniter application.=3C/p=3E
--B_ALT_5a7416736d6ea--
I have hidden my email id in this question for security purposes.
I find so many code examples that they wanted to change local php.ini and sendmail.ini files to send emails but I think that's not the requirement to send mail using smtp.
I also use the PHPmailer lib and it works for smtp mail, but why CodeIgniter email lib for SMTP is not working? Which PHP version is supported for this CodeIgniter SMTP settings?
Try this:-
$ci = get_instance();
$ci->load->library('email');
$config['protocol'] = "smtp";
$config['smtp_host'] = "mail.google.com";
$config['smtp_port'] = "26";
$config['smtp_user'] = "********#gmail.com";
$config['smtp_pass'] = "************";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";
$ci->email->initialize($config);
$ci->email->from('*********#gmail.com');
$email_body = "Sending Email from server.";
$this->email->to($userEmail']);
$this->email->subject('Email Subject');
$this->email->message($email_body);
$email = $this->email->send();
i want to send an email from my local host using code igniter. I'm using lamp here. My code shows below error
Exit status code: 127
Unable to open a socket to `Sendmail`. Please check settings.
Unable to send email using `PHP` `Sendmail`. Your server might not be configured to send mail using this method.
Date: Fri, 12 May 2017 08:01:46 +0200
From: "`jatin`"
Return-Path: <xxx>
To: xxx
Subject: =?UTF-8?Q?Hi..=20?=
Reply-To: <xxx>
User-Agent: `CodeIgniter`
X-Sender: xxx
X-Mailer: `CodeIgniter`
X-Priority: 3 (Normal)
Message-ID: <xxx>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use PHP mailer for sending mail.
using this you can send mail easily without any warning and error
Download PHP mailer from here: PHPMailer
require_once(APPPATH.'third_party/PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "test#gmail.com"; // your email address
$mail->Password = "test"; // your gmail password
$mail->SetFrom('test#gmail.com', 'Test'); //sender mail address
$mail->isHTML(true);
$mail->Subject = "Subject";
$mail->Body = 'hello there';
$destino = 'test#gmail.com'; // receiver email address
$mail->AddAddress($destino, "Receiver");
if(!$mail->Send()) {
return false;
} else {
return true;
}
You have to set access for less trusted apps in your Gmail account also:
Login to your gmail account
Click on MyAccount from Google Apps
Click on 'Signing in to Google' from left panel
And Turn on 'Allow less secure apps' from bottom of page
now try to send mail.it's works 100%.
when i am trying to upload the image in the web application using POST method of HTTP using Jmeter ,Its throwing error as below
Sampler Request:
Size in bytes: 436
Headers size in bytes: 335
Body size in bytes: 101
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 405
Response message: Method Not Allowed
Response headers:
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS, TRACE
Content-Length: 101
Content-Type: text/html
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Set-Cookie: ARRAffinity=a1634f39ccba9517317254d32be7078bb62c2877a947d85cab990f2708382045;Path=/;Domain=revflexsit.azurewebsites.net
Date: Tue, 28 Jun 2016 10:04:41 GMT
HTTPSampleResult fields:
ContentType: text/html
DataEncoding: null
Request:
POST http://revflexsit.azurewebsites.net/#//testerprofile
POST data:
--8WPDqrXY5glD81_9CcLHn-xfOTrWvH4Dh4srjx
Content-Disposition: form-data; name="profileUploadPhoto"; filename="Tulips.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
<actual file content, not shown here>
--8WPDqrXY5glD81_9CcLHn-xfOTrWvH4Dh4srjx--
[no cookies]
Request Headers:
Connection: keep-alive
Content-Length: 621121
Content-Type: multipart/form-data; boundary=8WPDqrXY5glD81_9CcLHn-xfOTrWvH4Dh4srjx; charset=US-ASCII
Host: revflexsit.azurewebsites.net
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_40)
Response Data:
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
The server response is pretty much self-explanatory, you're not allowed to make POST requests to that URL, only GET, HEAD, OPTION and TRACE ones.
Why just not to record your test scenario using HTTP(S) Test Script Recorder and modify the resulting test "skeleton" as required?
If you are still eager to build your scenario manually,looking into the http://revflexsit.azurewebsites.net/ site, it seems correct request will look something like:
Path: /api/TesterProfile/UploadTesterProfile?Id=${YOUR_ID_HERE}&UpdateAdminId=0&dimensions=x,y,x,y
Files Upload:
File Path: full path to image, you're trying to upload
Parameter Name: profileUploadPhoto
MIME Type: relevant photo MIME Type
Don't forget to tick "Use multipart/form-data for POST" box.
See How to Test Image Upload Functionality With JMeter for more detailed explanation.
I have a CRUD "clientes" and I added a button "email", when I click on it I would like to send an email with a username and a password
here is my button
$crud->add_action('Email', '', 'pendientes/pendientes_v/enviarmail', 'ui-icon-plus');
and then the function in my controller
function copyrows($id)
{
$this->load->model('cliente_model', 'client');
$clientInfo = $this->client->getInfo($client_id);
$this->email->from('myemail#gmail.com', 'Demo');
$this->email->to($clientInfo['email']);
$this->email->subject('Email Test');
$this->email->message('Hola tu usuario es ' . $clientInfo['email'] . ' y tu contraseƱa es ' . $clientInfo['clave']);
$this->email->send();
echo $this->email->print_debugger();
}
my model cliente_model.php
<?php
class Cliente_Model extends CI_Model{
public function getInfo($client_id){
return array('id' => $cliente_id,'email' => $email,'clave' => $clave);
}
}
here the errors
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
From: "Demo"
Return-Path:
Reply-To: "myemail#gmail.com"
X-Sender: myemail#gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <51478bcb599c0#gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Email_Test?=
Hola tu usuario es y tu contraseƱa es#gmail.com>#gmail.com>#gmail.com>
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/oscar/public_html/crud/system/core/Exceptions.php:185)
Filename: core/Common.php
Line Number: 438
I know I am receiving a null value but I can't find the solution, hope someone can help me.
thanks in advance!
i had the same problem and it's a hell, i fixed only using php native:
mail();
instead of using CI mail library
maybe it fixes your problem too