Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-10-2003, 12:28 PM   PM User | #1
celestine
Regular Coder

 
Join Date: Oct 2003
Location: Australia
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
celestine is an unknown quantity at this point
Mail and SMTP

Hi all

My host told me there was spamming reported on the server and they are going to disable the mail() function and told us to use SMTP to send mail instead.

Well, I've always been rather hazy over the two mail function. In fact, I always thought they were the same.

I have several scripts using the mail(); function and I doubt I'll be able to send out emails when the server starts disabling mail().

Can someone tell me what's the difference between mail and smtp? and if I'll have to change alot of my code just to use smtp to send out my emails.

Thanks.
celestine is offline   Reply With Quote
Old 12-10-2003, 01:20 PM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,896
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
SMTP is a protocol that mail servers use to talk to anyone trying to send mail through them , its a challenge/response protocol as in HTTP, FTP etc , so its not actually a function.

To use PHP to do SMTP you need to use the socket functions or streams , which is not straightforward so I suggest you look for an existing SMTP script or class at somewhere like hotscripts.com or phpclasses.org.

There are some great SMTP scripts around but generally they are OOP (using classes) so look for one that provides examples if you are not used to that.

... the problem you are going to have is with ready-made scripts that probably utilise the mail() function (many forums for example) , so you will either need to hunt down all the mail() calls in those scripts and replace them , OR get software that already uses SMTP scripts instead of mail() (FUDforum , PHPbb etc)

....note one could say to ones host that, this is thier problem not yours , there are ways of configuring sendmail or whatever mailserver they are using to stop spam at its source and look for spam like activities , some hosts will limit sendmail to $x mails per minute per user for example, personally I would be asking my host to track down & ban the abusers rather than let everyone else suffer .... but thats probably easier for me to say than for them to implement
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 12-11-2003, 01:51 AM   PM User | #3
celestine
Regular Coder

 
Join Date: Oct 2003
Location: Australia
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
celestine is an unknown quantity at this point
thank you so much firepages. I looked at some of the SMTP scripts and I must say they are a bit complex for me, though if I really have to use them, I will make it a point to learn.

Quote:
....note one could say to ones host that, this is thier problem not yours , there are ways of configuring sendmail or whatever mailserver they are using to stop spam at its source and look for spam like activities , some hosts will limit sendmail to $x mails per minute per user for example, personally I would be asking my host to track down & ban the abusers rather than let everyone else suffer .... but thats probably easier for me to say than for them to implement
hehee. I agree, and luckily after I sent a support ticket, they told me i'm not on the server that's implementing this. So i'm not affected afterall, which is a major relief. Hunting all those mail() calls is going to be messy.

Thanks for all your help.
celestine is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:30 PM.


Advertisement
Log in to turn off these ads.