+ Reply to Thread
Results 1 to 4 of 4

Thread: External SMTP server with PHP?

  1. #1
    Plasmator is offline New Bee
    Join Date
    Aug 2006
    Posts
    6
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default External SMTP server with PHP?

    I run a website that allows people to list themselves as "seeking tickets" to a local event, and this site allows others to contact them.

    Recently, that's been occasionally running up against WHB's 200 per hour limit on sent email. Especially now that I've also got a "contact us" RSVP page for our upcoming wedding. Bad timing on my part, I guess.

    I'm trying to figure out how to get PHP to send SMTP email through another SMTP server I have access to, but I continue to run into problems. Has anyone found an SMTP mail class that's capable of doing so on a WHB shared account? I've tried with mail() wrappers I've written and with the lovely swiftMailer class, but no luck. Most of the errors seem to imply that we can't open sockets. swiftMailer, for example, gives:

    fsockopen returned Error Number 110 and Error String 'Connection timed out']

    Anyone got a good example of working code to send mail through an outside SMTP server?

    This wouldn't be an issue if they'd bump the allowable outgoing email limits, but so it goes.

  2. #2
    squinky86 is offline Senior Member
    Join Date
    Jan 2008
    Posts
    100
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The workaround to doing this is to first get ssh access to your system. Then, install "ssmtp" in a directory on your system. Configure it correctly with your smtp information, and in php.ini, set the following:

    sendmail_path = "~/path/to/ssmtp/sendmail -t -i"

    I don't know if this is the best way to do it (or even if it's within WHB's rules), but it's one solution that may work for you.

  3. #3
    squinky86 is offline Senior Member
    Join Date
    Jan 2008
    Posts
    100
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I tested this on my account using ssmtp and the PEAR Mail class (you'll need to upload pear.php along with the Mail library to your account to use this module). The details for ssmtp are the same as I outlined above, with the exception of setting the sendmail command to the full path instead of the relative path.

    Details for using the Mail class are at http://email.about.com/od/emailprogr...t/et073006.htm

  4. #4
    JamesFu's Avatar
    JamesFu is offline Observer
    Join Date
    Mar 2010
    Location
    Singapore
    Posts
    4
    Servers
    rs14.abstractdns.com
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by squinky86 View Post
    The workaround to doing this is to first get ssh access to your system. Then, install "ssmtp" in a directory on your system. Configure it correctly with your smtp information, and in php.ini, set the following:

    sendmail_path = "~/path/to/ssmtp/sendmail -t -i"

    I don't know if this is the best way to do it (or even if it's within WHB's rules), but it's one solution that may work for you.
    Can I trouble you for a command by command walkthrough on installing sSMTP, please? The guides I googled don't seem to apply to the SSH here. Thank you!

+ Reply to Thread

Posting Permissions

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