Welcome Guest, Not a member yet? Register   Sign In
Quick Email config File
#1

[eluser]taggedzi[/eluser]
I created a config file for email, based off the information found on the website. To save anyone the trouble hope it helps...

Only took a few min... but I decided to share.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
  *  Email Config Variables
  *
  *  These come directly from the documentation of Code Igniter 1.7.2 website.
  *  http://ellislab.com/codeigniter/user-guide/libraries/email.html
  *
  *  Var                Default             Options                     Description
  *  useragent            CodeIgniter        None                    The "user agent".
  *  protocol            mail                mail, sendmail, or smtp    The mail sending protocol.
  *  mailpath            /usr/sbin/sendmail  None                    The server path to Sendmail.
  *  smtp_host            No Default        None                    SMTP Server Address.
  *  smtp_user            No Default        None                    SMTP Username.
  *  smtp_pass            No Default        None                    SMTP Password.
  *  smtp_port            25                None                    SMTP Port.
  *  smtp_timeout       5                None                    SMTP Timeout (in seconds).
  *  wordwrap            TRUE                TRUE or FALSE (boolean)    Enable word-wrap.
  *  wrapchars            76                                        Character count to wrap at.
  *  mailtype            text                text or html            Type of mail. If you send HTML email you must send it as a complete web page. Make sure you don't have any relative links or relative image paths otherwise they will not work.
  *  charset            utf-8                                        Character set (utf-8, iso-8859-1, etc.).
  *  validate            FALSE                TRUE or FALSE (boolean)    Whether to validate the email address.
  *  priority            3                1, 2, 3, 4, 5            Email Priority. 1 = highest. 5 = lowest. 3 = normal.
  *  crlf             \n                 "\r\n" or "\n" or "\r"     Newline character. (Use "\r\n" to comply with RFC 822).
  *  newline            \n                 "\r\n" or "\n" or "\r"    Newline character. (Use "\r\n" to comply with RFC 822).
  *  bcc_batch_mode    FALSE                TRUE or FALSE (boolean)    Enable BCC Batch Mode.
  *  bcc_batch_size    200                None                    Number of emails in each BCC batch.
  *  
  */                      
$config['useragent']        = 'CodeIgniter';        
$config['protocol']         = 'mail';        
$config['mailpath']         = '/usr/sbin/sendmail';
$config['smtp_host']        = '';
$config['smtp_user']        = '';
$config['smtp_pass']        = '';
$config['smtp_port']        = 25;
$config['smtp_timeout']     = 5;
$config['wordwrap']         = TRUE;
$config['wrapchars']        = 76;
$config['mailtype']         = 'text';
$config['charset']          = 'utf-8';
$config['validate']         = FALSE;
$config['priority']         = 3;
$config['crlf']             = "\r\n";
$config['newline']          = "\r\n";
$config['bcc_batch_mode']   = FALSE;
$config['bcc_batch_size']   = 200;

/* End of file email.php */
/* Location: ./system/application/config/email.php */
#2

[eluser]flyenig[/eluser]
thank you for this
#3

[eluser]Miguel Diaz[/eluser]
Hi Can you help me a little bit and tell me how it works?

Greetings
#4

[eluser]taggedzi[/eluser]
Sorry for the late reply, I never notice there was a question here.

This is "a" config file to hold all of your email settings. Simply save it in your config folder

Code:
"/system/application/config/email.php"

Then change the settings in the file to match your mail server configuration, then call the email class as ussual...

The best summary I can point you to is CI's own page... http://ellislab.com/codeigniter/user-gui...email.html

There are other ways to do this... and all the information in this file is on that page... i just typed it into a config file.
#5

[eluser]fasc[/eluser]
Thanks for that help.
#6

[eluser]FreshProgrammer[/eluser]
Hi..

I follow and set the setting as showed above.But,still i can not send email through this codeigniter.

Below shows the error message that i had encountered.

Severity: Warning

Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Filename: libraries/Email.php

Line Number: 1519


If i am not mistaken,the space for smtp just leave it blank right?
Does anyone know how to send the email correctly?

Thank You
#7

[eluser]jason.wolfsmith[/eluser]
If your server (in this case localhost) is not set up for sending mail yet then you will need to provide a SMTP. A lot of people just use google.

Here is a link that should get you started. Using Google as SMTP

Just add google's SMTP host and port to the CI email configuration file provided above and change protocol to 'smtp'. You will need a valid google email address and password for this to work.
#8

[eluser]ninjayan[/eluser]
Thank you for sharing! I have tried sending email from gmail to yahoo and works fine. But when I send from yahoo to gmail, I received (sender email) a 'Mail Delivery Subsytem' Returned mail: see transcript for details

The original message was received at Fri, 21 Jun 2013 14:52:03 +0800
from localhost [127.0.0.1]

----- The following addresses had permanent fatal errors -----
<[email protected]>
(reason: 550-5.7.1 [122.52.102.190 1] Our system has detected an unusual rate of)

----- Transcript of session follows -----
... while talking to gmail-smtp-in.l.google.com.:
>>> DATA
<<< 550-5.7.1 [122.52.102.190 1] Our system has detected an unusual rate of
<<< 550-5.7.1 unsolicited mail originating from your IP address. To protect our
<<< 550-5.7.1 users from spam, mail sent from your IP address has been blocked.
<<< 550-5.7.1 Please visit http://www.google.com/mail/help/bulk_mail.html to review
<<< 550 5.7.1 our Bulk Email Senders Guidelines. qq3si1446949oeb.47 - gsmtp
554 5.0.0 Service unavailable

..I tried also sending gmail to gmail didn't receive an email.
.
Here's the debugger result.

Your message has been successfully sent using the following protocol: mail
User-Agent: DTSv2
Date: Fri, 21 Jun 2013 15:42:32 +0800
From: "DTS"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: DTSv2
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?DTS_Notification?=
Testing the email class.
#9

[eluser]quickshiftin[/eluser]
Thanks for sharing!




Theme © iAndrew 2016 - Forum software by © MyBB