Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Mail and SMTP

  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,067
    Thanks
    11
    Thanked 96 Times in 94 Posts
    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)

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    ....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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •