Click here to get back home

Accessing SMTP direct instead of using mail()

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Accessing SMTP direct instead of using mail() Beauregard T. Shagnasty 06-03-2008
Get Chitika Premium
Posted by Beauregard T. Shagnasty on June 3, 2008, 8:25 am
Please log in for more thread options
My shared web host has made some sort of upgrade to .. something .. the
support tech can't tell me what. It's a cPanel system, with all the
regular stuff. The site is a club site.

For years, I have been using the regular old mail(...) function for
things like sending broadcast messages to members. Yesterday, that
failed. The host now tells me I need to access the SMTP server directly,
using a valid email account and password. "It's a new security measure
to prevent spamming. Go find a script," was the tech's reply.

I found one, at:
http://us3.php.net/manual/en/ref.mail.php
2/3rds down, search the page for:
josephcmiller2 at gmail dot com

Port 25 doesn't work; the tech finally told me to try port 587. That
helps. No authentication is required, he said. However, the script fails
at:

// Say hello...
fputs($cp, "HELO ".$GLOBAL["SMTP_SERVER"]."\r\n");
$res=fgets($cp,256);
if(substr($res,0,3) != "250") return "Failed to Introduce";

..and I don't know what to do after that. $GLOBAL["SMTP_SERVER"]
contains the name of the server, ("mail.example.com") which works for
the fsockopen() code preceding the HELO lines. Any ideas, folks?

--
-bts
-Friends don't let friends drive Windows

Posted by Jerry Stuckle on June 3, 2008, 8:40 am
Please log in for more thread options
Beauregard T. Shagnasty wrote:
> My shared web host has made some sort of upgrade to .. something .. the
> support tech can't tell me what. It's a cPanel system, with all the
> regular stuff. The site is a club site.
>
> For years, I have been using the regular old mail(...) function for
> things like sending broadcast messages to members. Yesterday, that
> failed. The host now tells me I need to access the SMTP server directly,
> using a valid email account and password. "It's a new security measure
> to prevent spamming. Go find a script," was the tech's reply.
>
> I found one, at:
> http://us3.php.net/manual/en/ref.mail.php
> 2/3rds down, search the page for:
> josephcmiller2 at gmail dot com
>
> Port 25 doesn't work; the tech finally told me to try port 587. That
> helps. No authentication is required, he said. However, the script fails
> at:
>
> // Say hello...
> fputs($cp, "HELO ".$GLOBAL["SMTP_SERVER"]."\r\n");
> $res=fgets($cp,256);
> if(substr($res,0,3) != "250") return "Failed to Introduce";
>
> ..and I don't know what to do after that. $GLOBAL["SMTP_SERVER"]
> contains the name of the server, ("mail.example.com") which works for
> the fsockopen() code preceding the HELO lines. Any ideas, folks?
>

Get phpmailer. It handles all of that.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Posted by Beauregard T. Shagnasty on June 3, 2008, 9:31 am
Please log in for more thread options
Jerry Stuckle wrote:

> Beauregard T. Shagnasty wrote:
>> My shared web host has made some sort of upgrade to ..
>
> Get phpmailer. It handles all of that.

I looked at that during my search. It appears to me it needs to be
installed on the *shared* web host, and I don't see how I can do that.

(The search also turned up some results that said
http://www.swiftmailer.org/
is even better, but the same restrictions apply.)

I can't do this on my home PC as there is an online associated members'
database maintained by the membership chairman of the year, who also
needs to use some of the mailing functions. Club officers also have some
access to certain functions.

--
-bts
-Friends don't let friends drive Windows

Posted by Michael Fesser on June 3, 2008, 9:53 am
Please log in for more thread options
.oO(Beauregard T. Shagnasty)

>Jerry Stuckle wrote:
>
>> Beauregard T. Shagnasty wrote:
>>> My shared web host has made some sort of upgrade to ..
>>
>> Get phpmailer. It handles all of that.
>
>I looked at that during my search. It appears to me it needs to be
>installed on the *shared* web host, and I don't see how I can do that.

Just upload it to some directory on your host and include the two
classes in your script, that's all. No further installation necessary.
The configuration can be set at runtime.

Micha

Posted by Beauregard T. Shagnasty on June 3, 2008, 7:30 pm
Please log in for more thread options
Michael Fesser wrote:

> .oO(Beauregard T. Shagnasty)
>>Jerry Stuckle wrote:
>>> Beauregard T. Shagnasty wrote:
>>>> My shared web host has made some sort of upgrade to ..
>>>
>>> Get phpmailer. It handles all of that.
>>
>> I looked at that during my search. It appears to me it needs to be
>> installed on the *shared* web host, and I don't see how I can do
>> that.
>
> Just upload it to some directory on your host and include the two
> classes in your script, that's all. No further installation
> necessary. The configuration can be set at runtime.

I've been playing with phpmailer. After some modification - and
rewriting some of the mailing scripts/pages - it works after a fashion.
Heh, 90-something KB to replace one mail() line.

Oh, and this. I just got a 'followup' from the tech guy, who says, "Your
normal php mail() function should now be working."

Duh... Last night I wasn't allowed to use it.

--
-bts
-Friends don't let friends drive Windows

Similar ThreadsPosted
Mail via SMTP June 12, 2007, 2:16 pm
mail() on linux to use other smtp server February 9, 2005, 6:03 pm
Non-local SMTP mail function. October 4, 2006, 5:08 pm
Is it possible to send mail through authenticated SMTP? May 27, 2008, 11:54 am
SMTP mail problem (but works OK in Outlook) December 17, 2004, 1:43 am
mail - differentiate between smtp envelope to and header to? June 29, 2005, 9:32 am
[function mail() Windows XP]SMTP localhost April 4, 2006, 3:58 am
test mail() on development machine w/o smtp server June 17, 2007, 11:05 am
Warning: mail(): SMTP server response: 505 5.7.3 Must issue a STARTTLS command first February 6, 2006, 6:56 am
mail() function error: (SMTP server response: 501 5.5.4 Invalid Address) May 11, 2008, 12:53 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap