mail() w/o SMTP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

mail() w/o SMTP?

Post by rxsid »

Hi All,

I've got php 4.3.1 running on a windows 2003 advanced server. I was wondering if there is a way to be able to use php's mail() function w/o having the server setup for SMTP/POP3 on port 25, or even setup at all?

In other words, is there some way to use mail() (with COM?) to open a port, send the email, and then close the port?

Thanks!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

As far as I'm aware the mail() function uses SMTP to send mail as per usual....

I can't see why not to use it...
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

mail() is SMTP only

there is also imap_mail(), but im not sure if that will help you
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Sending mail without using PHP may be useful to you if you just need data sent to your email from other users. I'm not sure what the case is, but if so, this may be useful to you.
Taken from scriptschool.com/php Lesson 6

Sending email through a form without using PHP

To send email through a form you actually don't even need PHP, but there are several good reasons to use PHP. Using the form enctype we can directly dump the contents of a form to email like this:

<form METHOD=POST ENCTYPE="text/plain" action="mailto:youremail@yourisp.com">
Name: <input type="text" name="name">
Your Email: <input type="text" name="email" size=40>
URL: <input type="text" name="url"> <input type="submit" value="Submit"></form>

While this is useful for some, there is a problem in that you can't actually label the contents of the form, you just get the results. This is where using PHP comes in and specifically the function called mail().
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I'd steer clear of the mailto method if I was you.

I was set a project at work and was forced to use the mailto function but it's very unreliable and you can't manipulate the sent data enough to get a good result.

Also.... this falls down depending upon the default mail client the user is using and whether or not they actually have anything set up in the default mail client.... plaenty of people rely on webamil these days such as hotmail.

Take it from me... it's not a good thing to use.

Maybe you should look further in imap_mail()
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

...

Post by s.dot »

He may not have a choice. If he needs data, he will have to rely on mailto. The data won't be organized, but some data's better than no data, BTW, why isn't your SMTP server set up?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Would that be my smtp server or rxsid's smtp? Mine is set up yes but rxsid doesn't wish to use it even if it is set up. I agree with what ur saying but I found using mailto to be very unreliable...
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

mailto wouldn't work. at all.

it would prompt the user with their mail client and try to send email FROM THEM. Very unlikely that is what he wants.

What's wrong with imap_mail?
Post Reply