Mail not sending
Posted: Sat Dec 28, 2019 6:59 am
Hello vesta community,
I have researched a lot on forums or on the web but nothing is working i am not able to send an email with SMTP settings, without the SMTP settings it's going to spam.
I am using Codeigniter framework,
Code that worked (without SMTP)
/////////////But this is going in SPAM/////////////
$this->load->library('email');
$this->email->from("[email protected]");
$this->email->to("[email protected]");
$this->email->subject("test email");
$this->email->message("test");
if ($this->email->send()) {
echo 'Your Email has successfully been sent.';
} else {
show_error($this->email->print_debugger());
}
/////////////But this is going in SPAM/////////////
After that, I have created an email account for one of my domain and with its smtp settings:
Username:[email protected]
Password:7QD4GzSDKc
SMTP hostname:mediabharti.org
SMTP port:587
SMTP security:STARTTLS
//// Code With SMTP///
$this->load->library('email');
$config = array();
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mediabharti.org';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = '7QD4GzSDKc';
$config['smtp_port'] = 25;
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from("[email protected]");
$this->email->to("[email protected]");
$this->email->subject("test email");
$this->email->message("test");
if ($this->email->send()) {
echo 'Your Email has successfully been sent.';
} else {
show_error($this->email->print_debugger());
}
//////////
But Its throwing Error:
A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to mediabharti.org:25 (Connection timed out)
Filename: libraries/Email.php
Line Number: 2055
Backtrace:
File: /home/medbha/web/english.mediabharti.net/public_html/application/controllers/Home.php
Line: 48
Function: send
File: /home/medbha/web/english.mediabharti.net/public_html/index.php
Line: 315
Function: require_once
//////
Please Somebody Help!!!
I have researched a lot on forums or on the web but nothing is working i am not able to send an email with SMTP settings, without the SMTP settings it's going to spam.
I am using Codeigniter framework,
Code that worked (without SMTP)
/////////////But this is going in SPAM/////////////
$this->load->library('email');
$this->email->from("[email protected]");
$this->email->to("[email protected]");
$this->email->subject("test email");
$this->email->message("test");
if ($this->email->send()) {
echo 'Your Email has successfully been sent.';
} else {
show_error($this->email->print_debugger());
}
/////////////But this is going in SPAM/////////////
After that, I have created an email account for one of my domain and with its smtp settings:
Username:[email protected]
Password:7QD4GzSDKc
SMTP hostname:mediabharti.org
SMTP port:587
SMTP security:STARTTLS
//// Code With SMTP///
$this->load->library('email');
$config = array();
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mediabharti.org';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = '7QD4GzSDKc';
$config['smtp_port'] = 25;
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from("[email protected]");
$this->email->to("[email protected]");
$this->email->subject("test email");
$this->email->message("test");
if ($this->email->send()) {
echo 'Your Email has successfully been sent.';
} else {
show_error($this->email->print_debugger());
}
//////////
But Its throwing Error:
A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to mediabharti.org:25 (Connection timed out)
Filename: libraries/Email.php
Line Number: 2055
Backtrace:
File: /home/medbha/web/english.mediabharti.net/public_html/application/controllers/Home.php
Line: 48
Function: send
File: /home/medbha/web/english.mediabharti.net/public_html/index.php
Line: 315
Function: require_once
//////
Please Somebody Help!!!