Problems using smtp mail |
[eluser]Russ Back[/eluser]
I'm new to CI so I hope this isn't a newbie no-brainer! Basically I'm trying to send an email via smtp but I'm getting some php errors. Here's my config code, everything in uppercase is a real value in my app: Code: $config['protocol'] = 'smtp'; And here's my controller: Code: $this->load->library('email'); Pretty basic stuff, but I'm getting the following errors: Quote:A PHP Error was encountered Any ideas what might be going wrong here??
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgntier community. I am currently unable to ping your mail server or your domain name, so my guess is that this is a new host, and the information has not yet propagated up the DNS chain. I would recommend leaving it for 24-72 hours. Simply try pinging it, and once it resolves an IP address, you should be good to go, assuming that the domain name you're using is correct, and the mail subdomain exists.
[eluser]SitesByJoe[/eluser]
I've also noticed that when using SMTP, you need to first set your config stuff in an array first, then do an "initialize" with your array as a parameter. The syntax to do so is in the user guide on the email library page. Not being to connect to the email server is a more obvious problem. My own troubles in the past with SMTP bring about the first statement.
[eluser]Russ Back[/eluser]
The smtp server I'm connecting to is mail.theclosetbureau.com, which I believe is set to not respond to pings. The config I've got is the same as using the initialize method - it's just stored in the config folder as a global config for all email functionality, rather than having it stored in each controller.
[eluser]TheFuzzy0ne[/eluser]
The server doesn't need to respond to a ping to resolve to an IP address. ![]() You can see this if you try to ping microsoft.com
[eluser]Russ Back[/eluser]
I think this might be a relay issue - when I run the script from www.theclosetbureau.com it works fine, but when I work in my localhost with the virtual host local.theclosetbureau.com, I get the errors.
[eluser]Thiago Luiz[/eluser]
Hi, I'm using Smarty to send emails using SMTP by CodeIgniter. Try to download it and put the Smarty folder at the same level of the system folder. Then in your controller use something like this: $ from = $ email; / * e-mail address * / $ to = "[email protected]"; $ subject = "Message sent by IC"; $ message = "This is an example. I am trying to send via SMTP. / / Instance a new object of phpmailer $ Mail = new PHPMailer (); $ Email-> IsSMTP () / / send email by smtp / / Set language you prefer, the Portuguese br $ Email-> SetLanguage ( "br"); / / Active hmtl mail $ Email-> IsHTML (true); $ Email-> From = $ from; / / Sender address $ Email-> FromName = "Name"; / / Address of destination $ Email-> AddAddress ($ a); / / Subject of the e-mail $ Email-> Subject = $ subject; / / Body message, accepts html $ Email-> Body = $ message, / / body of the message if HTML / / Html if message body is not supported $ Email-> AltBody = $ message; / / Send mail if (! $ Mail-> Send ()) ( / / If the email has been sent to a page redirect error $ this-> load-> view ( 'errors / email_not_sent', $ data); ) else ( / / If successful, redirects to a confirmation page $ this-> load-> view ( 'accept / email_sent', $ data);
[eluser]TheFuzzy0ne[/eluser]
[quote author="russback" date="1234924029"]I think this might be a relay issue - when I run the script from www.theclosetbureau.com it works fine, but when I work in my localhost with the virtual host local.theclosetbureau.com, I get the errors.[/quote] www.theclosetbureau.com resolves for me when I ping it. The mail sub domain has also started resolving for me. If it doesn't work now, then it most likely is a relay issue of some sort. |
Welcome Guest, Not a member yet? Register Sign In |