Log in

View Full Version : mail() just send? Can it receives emails?



sysout
02-06-2009, 03:38 AM
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


this code just can do sending email (SENT items), can anyone give how to make receive emails? (Inbox) ?

thanks

JasonDFR
02-06-2009, 06:39 AM
I've never done it so I can't post any answers here, but Google seems to return some good links: http://www.google.com/search?hl=en&q=PHP+receive+emails

Once you figure it out, let me know what you've done.

djr33
02-06-2009, 09:52 AM
PHP has a system embedded that allows you to send out emails through a default setup with the server.... it interacts with a mail server. That is to say that it isn't a mail server itself.
Yes, it only sends messages, and, no, it cannot receive.
It can, however, get incoming emails if you set it up differently. Google is a good place to start because you can look at several different strategies available.
But in short you cannot with the default tools setup a complete mail server.
Depending on your hosting account/server, the options may vary, too.
The imap functions are also for use with mail, so they might be somewhere to start and are, in many setups, installed by default.

I hope this gets you started.

sysout
08-15-2009, 02:17 PM
PHP has a system embedded that allows you to send out emails through a default setup with the server.... it interacts with a mail server. That is to say that it isn't a mail server itself.
Yes, it only sends messages, and, no, it cannot receive.
It can, however, get incoming emails if you set it up differently. Google is a good place to start because you can look at several different strategies available.
But in short you cannot with the default tools setup a complete mail server.
Depending on your hosting account/server, the options may vary, too.
The imap functions are also for use with mail, so they might be somewhere to start and are, in many setups, installed by default.

I hope this gets you started.

thank you, very nice suggestions

Bungeebones
08-15-2009, 08:05 PM
Also, PHPMailer is a class that can be used with and alongside your web hosts email and can greatly enhance your email capabilities. Its open source and is used by a lot of php scripts

sysout
09-25-2009, 12:59 AM
Also, PHPMailer is a class that can be used with and alongside your web hosts email and can greatly enhance your email capabilities. Its open source and is used by a lot of php scripts

can I Used PHPMailer for receive sms?
btw, I wanna used my PC as a host for my website only ^^ but It seems not working.

can I activate STMP for my host? How to do it? :)

thetestingsite
09-25-2009, 01:46 AM
I posted some code somewhere on these forums that would receive a messages sent to an email address and the code would check the email and take the message and save the text to a database. As far as the SMTP service on your server, what mail server program are you using? You also have to make sure that you have port 25 unblocked and/or forwarded in your firewall/router. Also, some ISPs block port 25 because of spammers, so this may also be a reason why you can't get it to work.

Hope this helps.