473,508 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing SMTP direct instead of using mail()

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
Jun 27 '08 #1
13 1782
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.
js*******@attglobal.net
==================
Jun 27 '08 #2
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
Jun 27 '08 #3
..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
Jun 27 '08 #4
Beauregard T. Shagnasty wrote:
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.
Nope, you can put it on your website then include the classes. It works
fine with shared hosts. If you have access to the directory below your
webroot, I recommend placing it there (where I place all include files).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 27 '08 #5
the problem with normal classes is, that they all cant handle the TLS
encoding google wants you to use. Because of this google rejects the
connection. I dont know whether phpmailer can handle this but normal
scripts, you find will only work with other smtp servers
Jun 27 '08 #6
Martin wrote:
the problem with normal classes is, that they all cant handle the TLS
encoding google wants you to use. Because of this google rejects the
connection. I dont know whether phpmailer can handle this but normal
scripts, you find will only work with other smtp servers
He's not using gmail, so the point is moot. But phpmailer does handle
TLS security quite well.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 27 '08 #7
On Tue, 3 Jun 2008 11:08:33 -0700 (PDT), Martin wrote:
the problem with normal classes is, that they all cant handle the TLS
encoding google wants you to use. Because of this google rejects the
connection. I dont know whether phpmailer can handle this but normal
scripts, you find will only work with other smtp servers
http://www.xpertmailer.com/ as referenced at
http://us2.php.net/manual/en/ref.mail.php#82433

Is there anything else you need on this silver platter?

--
88. If a group of henchmen fail miserably at a task, I will not berate them
for incompetence then send the same group out to try the task again.
--Peter Anspach's list of things to do as an Evil Overlord
Jun 27 '08 #8
Peter H. Coffin wrote:
On Tue, 3 Jun 2008 11:08:33 -0700 (PDT), Martin wrote:
>the problem with normal classes is, that they all cant handle the TLS
encoding google wants you to use. Because of this google rejects the
connection. I dont know whether phpmailer can handle this but normal
scripts, you find will only work with other smtp servers

http://www.xpertmailer.com/ as referenced at
http://us2.php.net/manual/en/ref.mail.php#82433

Is there anything else you need on this silver platter?
Hey,
I've written a tutorial on doing this with pear mail, with uthentication
and tls, and without.

http://phpmaniac.net/wiki/index.php/...ing_using_SMTP

leigh
Jun 27 '08 #9
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
Jun 27 '08 #10
..oO(Beauregard T. Shagnasty)
>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.
You'll soon learn that PHPMailer is much more powerful and far more
convenient than the simple mail() function, where you would have to do a
lot of things by hand, especially if you want to send multi-part mails.

The only things that I don't like about PHPMailer are some of the method
names, which are misleading. For example isHtml() shouldn't set the used
mode, but just return a TRUE or FALSE. Anyway, such things are easy to
fix with a wrapper class if necessary, the rest is just working fine.

Micha
Jun 27 '08 #11
Beauregard T. Shagnasty wrote:
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.
Hmmm, not sure why you had to rewrite some of the scripts. The couple
of times I've used it it's worked fine. But you must have some really
off-the-wall requirements from your host.

Interesting that now mail() works. They must have had a bunch of
complaints from their users.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 27 '08 #12
Michael Fesser wrote:
.oO(Beauregard T. Shagnasty)
>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.

You'll soon learn that PHPMailer is much more powerful and far more
convenient than the simple mail() function, where you would have to
do a lot of things by hand, especially if you want to send multi-part
mails.
I'll agree it's powerful. However, it far exceeds my needs, which
consist only of sending short text messages^1 to broadcast events to our
members, to confirm registrations (about 150 ten-line messages per
summer), a little members-only "forum", and the contact page. There are
never attachments nor embedded graphics, for example.

But I'll still do some more experimenting with it.

1. HTML is for web pages <g>

--
-bts
-Friends don't let friends drive Windows
Jun 27 '08 #13
Jerry Stuckle wrote:
Interesting that now mail() works. They must have had a bunch of
complaints from their users.
It worked for one run of a half-dozen individual messages to rally
registrants.

Then it failed on a broadcast of coming events to the club members. Club
email address in TO: and a hundred members in BCC:. That script is
unmodified for years.

I reopened the trouble ticket. :-(

--
-bts
-Friends don't let friends drive Windows
Jun 27 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3814
by: Fernando M. | last post by:
Hi, i made a test with smtplib module a few days ago, for sending mails, and i was wondering if there's another module for running an SMTP server, so i could make a standalone script for sending...
9
4293
by: Bob Jones | last post by:
We have developed a commercial ASP.net application (personal nutrition management and tracking); we want to send smtp email from within it. For our development box, we use WinXP Pro, IIS 5.5,...
34
18142
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.