why is codeigniter email not functional for abc#company.com.np - codeigniter

I am using codeigniter email. Everything is correct except that mail isn't sent to my client email which is something like abc#companyname.com.np but goes to gmail and my office mail.I have bulk email ids to send to. Have I done something wrong or is it the problem of client's company mail settings ??
$this->load->library('email');
$config['mailtype'] = 'html';
$config['validate'] = TRUE;
$this->email->initialize($config);
$this->email->from('abc#gmail.com', 'ABCTechnologies');
$list = array($form->admin_email);
$this->email->to($list);
$this->email->subject($form->form_title);
$message = 'You have got a new Feedback. Here are the Details : <br/>';
'.$email_fields['message'].'<br/>';
$this->email->message($message);
$this->email->send();
where $list is array of mail id.Any suggesstions are welcome.
I changed the smtp also but to no avail.
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mail.sipradi.com.np';
and smtp port is by default 25.
Help

Related

mail() on https

I setup a website that uses PHP mail(). I can get it to successfully run if I hit the script on http:// but if I switch to https:// it does not work! I use Godaddy for hosting and have a certificate purchased through them. I am not sure if I need to setup anything in the php.ini file or not. My mailscript looks like this:
$from_respondent_email = "calendar#mydomain.com" ;
$headers_respondent_email = "From: $from_respondent_email";
$subject_respondent_email = "Technical Support Request";
$body_respondent_email = "We received a support ticket from mydomain.com:\n\n";
$body_respondent_email .= "Test block of text";
$send = mail("myname#gmail.com", $subject_respondent_email, $body_respondent_email, $headers_respondent_email);
$to ="myname#gmail.com";
$subject = "Technical Support Request";
$message = "We received a support ticket from mydomain.com:\n\n";
$from = "calendar#mydomain.com";
$headers = "From: $from_respondent_email";
mail($to,$subject,$message,$headers);
Try this. It'll work. I used this in my website and its working :)

Could not instantiate mail function in joomla 2.5.4

I am trying to send mail from my component when the user registers. I tried all three i.e PHPMail, Sendmail and SMTP but none works. I am testing it in localhost (WampServer 2.2) and the Joomla version is 2.5.4. I am not sure this is WampServer problem or Joomla or my own code. This is my code:
function postmail($name, $receiver){
jimport('joomla.mail.helper');
$mailer =& JFactory::getMailer();
$config =& JFactory::getConfig();
$sender = array($config->getValue( 'config.mailfrom'),$config->getValue( 'config.fromname' ) );
$mailer->setSender($sender);
$recipient = $receiver;
$mailer->addRecipient($recipient);
$body = "<body><br><p>";
$body .= "<strong>$name,</strong> ";
$body .= "</p><br></body>";
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setBody($body);
$send =& $mailer->Send();
if ( $send != true ) {
//echo 'Error sending email: ' . $send->message;
return false;
} else {
//echo 'Mail sent';
return true;
}
}
It gets the error 'could not instantiate mail function'.
i am sure there are many reasons causing this problem. but to test you can always create a mail server of your own by installing this tool here http://www.toolheap.com/test-mail-server-tool/
you don't have to change anything except that you put localhost as the smtp host in joomla mail settings and then in your webserver's php.ini, add the smtp=localhost. thats it, it should work.
this is just to test whether your code is correct and you are using the correct mail settings in joomla. if this doesn't work then, i am sure the problem is not in your code but in your mail settings.
To understand what the problem is you really need to get the error message.
Change
//echo 'Error sending email: ' . $send->message;
to
echo 'Error sending email:'.$send->get('message');
then run it again. The error that you get should tell us why it isn't instantiating. Let us know what it says so we can help you out.

SMTP Codeigniter email error '354 End data with .'

I'm having trouble getting the Codeigniter email library working on a new server.
This code has previously worked before but has recently stopped working and I cannot for the life of me figure out why. Essentially, here is the code:
$this->email->from('example#example.com', 'Intranet');
$this->email->to($c['email']);//This is def a valid email
//$name is being obtained from elsewhere
$this->email->subject('Time manager reminder');
$this->email->message("
{$name[0]},
<br/><br/>You haven’t completed your time for today. Please don’t forget to do so<br/><br/>
Intranet
");
$this->email->send();
And the email.php config password
$config['mailtype'] = "html";
$config['priority'] = 1;
$config['protocol'] = "smtp";
$config['smtp_host'] = "my server..";
$config['smtp_user'] = "u/n";
$config['smtp_pass'] = "p/w";
$config['smtp_timeout'] = 1;
$config['validate'] = true;
The error I receive from $this->email->print_debugger(); is as follows:
data: 354 End data with .
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
You can view the full error on pastebin here http://pastebin.com/y9UeaEGY
I've crossed out the emails in all places, but I can assure you they are valid and used email addresses.
I'd appreciate any help you can offer. Thanks
I figured out the reason. Apparently, in the config, you need to set
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
manually in the email.php file. Codeigniter doesn't seem to do it by default. Odd :)

CakePHP email not sending but showing in debug mode

My CakePHP should send an email when a button is clicked, however it doesn't. Also, the email will be displayed as a flash message if I run it in debug mode: ($this->Email->delivery = 'debug';).
Note: Email is set up to set up to use PHP mail() function.
Code to call the email function:
$this->_sendUpdateEmail( $this->Auth->user('id'), $about_id );
Email function
function _sendUpdateEmail($from_user_id, $about_id) {
$fromUser = $this->User->read(null, $from_user_id);
$users = $this->User->find('all', array(
'conditions' => array('User.distribution =' => 1)
));
# loop to send email to all users who are marked as on the distribution list
for($i = 0, $size = sizeof($users); $i < $size; ++$i) {
$user = $users[$i]['User'];
$this->Email->from = $fromUser['User']['email'];
$this->Email->replyTo = $fromUser['User']['email'];
$this->Email->to = $user['email'];
$this->Email->subject = 'Test email';
$this->Email->template = 'update';
$this->Email->sendAs = 'both'; // both = html and text
$this->set('user', $user);
$this->set('about', $about_id);
$this->Email->send();
$this->Email->reset();
}
}
Any ideas as to why the emails show in debug mode but won't actually send?
I think the reason why my emails were not sending was because there was no mail server configured on the web server my CakePHP was running on so there was no way to route the emails. However, this meant they would show up in the debug because they were generated successfully, just not sent.
In the end, I ended up using my company's Exchange mail server using the SMTP settings.
Code to use SMTP to send CakePHP emails
$this->Email->smtpOptions = array(
'port'=>'25',
'timeout'=>'30',
'host' => '192.168.0.244',
);
// Other email code here, e.g. from and to etc...
$this->Email->delivery = 'smtp';
I think the issue here is that mail server is not set right Linux comes built in with mail sending functionality but not windows (no idea on mac). look into smtp options as u can easily setup smtp email sender on Windows
Setting up smtp windows - http://publib.boulder.ibm.com/infocenter/cqhelp/v7r1m2/index.jsp?topic=/com.ibm.rational.clearquest.webadmin.doc/topics/c_config_email_smtp_win.htm
and
http://book.cakephp.org/view/1290/Sending-A-Message-Using-SMTP

Code Igniter email config to config.php

I've put my email configurations in the config.php but I don't know how I can access them in my controller.
In my config.php:
/*EMAIL CONFIG*/
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = 'username';
$config['smtp_pass'] = 'pass';
$config['smtp_port'] = '465';
$config['mailtype'] = 'html';
Should I make an instance of the super global object?
Thanks in advance.
You don't put email config settings in config.php. You make a new file called email.php and place it in the config folder. CI will automatically detect the email config setting from that file.
Look under "Setting Email Preferences in a Config File"
http://ellislab.com/codeigniter/user-guide/libraries/email.html
You can access it with:
$this->config->item('protocol');
Also, see the relevant chapter in CodeIgniter User Guide

Resources