Welcome Guest, Not a member yet? Register   Sign In
First Email
#1

[eluser]akkumaru[/eluser]
This is my first time trying to send email with PHP & CI,,
An error (to be predicted) is occured:

Quote:A PHP Error was 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: 1444

What things SHOULD i prepare & configure before sending emails?
Currently I use the Apache Web Server (bundled in XAMPP) running on WinXp
#2

[eluser]KnMn[/eluser]
Have you started Mercury in the XAMPP control panel?

Mercury is the mail transport system included with XAMPP. It is your SMTP server.

If you haven't started it, do that now, and try again.

When I tried it, PHP gave me an error saying that sendmail_from wasn't set in php.ini. To fix this, you can either include a "From:" in the additional headers of your mail function, like so:
Code:
mail($to, $subject, $message, "From: [email protected]");

Or you can edit your php.ini. For XAMPP, the only php.ini that matters is in /xampp/apache/bin/.
Find the line that says:
Code:
;sendmail_from = [email protected]
and remove the semicolon from the start of the line to uncomment it. You'll probably want to change the email address too.

Save php.ini, restart apache and try again.

Hope this helps Smile

EDIT:
Just remembered, another error that I got was a response from the SMTP server saying that it didn't relay non-local mail.

If you get this, you can fix it by going into Mercury (Click the admin button next to Mercury on the XAMPP control panel). Then go to Configuration > MercuryS SMTP Server. On the Connection Control tab, under Relaying Control, uncheck Do not permit SMTP Relaying of non-local mail.

NOTE: I'm not sure if this is a good idea. I don't know much about SMTP servers. I think this just means that anyone can connect to your SMTP server and send mail with it? If you want to know more about SMTP servers and Mercury and stuff, just google. Smile
#3

[eluser]akkumaru[/eluser]
ohh,, thank you!,,

,,one more thing
in the email class, what does the 'path' relative to??
for example, if i want to attach file stored in the htdocs/web_folder/files/hello.jpg
how do i call it?
#4

[eluser]akkumaru[/eluser]
i don't receive any error,,
but the sent mail seems failed to arrive
i config the protocol to 'smtp', but it still used the 'mail'

btw,,
i tried sending email using the mercury,, after reconfigured according to your post,,
the mail arrived succesfully to its destination,,




Theme © iAndrew 2016 - Forum software by © MyBB