php mail setup for my website.

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
saravanaprabhu
Forum Newbie
Posts: 2
Joined: Sun Aug 28, 2011 12:25 pm

php mail setup for my website.

Post by saravanaprabhu »

hi,

I am a newbie to php and i was working on my own website. i want the step by step procedure to create a mail setup from which i can send mails from my website.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: php mail setup for my website.

Post by phphelpme »

User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: php mail setup for my website.

Post by califdon »

saravanaprabhu wrote:I am a newbie to php and i was working on my own website. i want the step by step procedure to create a mail setup from which i can send mails from my website.
It depends on where your website is hosted. If it is hosted at a commercial hosting service (by contrast to hosting it yourself on your own server--not likely, if you're just beginning), you must contact Tech Support at your hosting service. Typically, the hosting service provides outgoing (SMTP) and incoming (POP3 or IMAP) servers as part of their hosting service. In any case, your PHP scripts must have access to such servers.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: php mail setup for my website.

Post by phphelpme »

I got the impression what was required is a step by step guide to be able to send mail from the website and not setup a SMTP and POP.

Maybe I am wrong though... lol

Best wishes
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: php mail setup for my website.

Post by califdon »

phphelpme wrote:I got the impression what was required is a step by step guide to be able to send mail from the website and not setup a SMTP and POP.

Maybe I am wrong though... lol

Best wishes
Oh, you mean like open the visitor's default email client? Possibly so, but I didn't read it that way.
saravanaprabhu
Forum Newbie
Posts: 2
Joined: Sun Aug 28, 2011 12:25 pm

Re: php mail setup for my website.

Post by saravanaprabhu »

I want to send email to users who register to my website.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: php mail setup for my website.

Post by phphelpme »

So you mean a user logs on to your site, enter their email address and you want to email them a username and password or something or email them with updated information etc?

I think you need to be more specific buddy.

Best wishes
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: php mail setup for my website.

Post by phphelpme »

The link below provides a basic overview and code to get information from user and send email so you should be able to adapt the code to your needs and requirements but at least its a place for you to start and get used to the coding:

http://www.w3schools.com/php/php_mail.asp

Best wishes
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: php mail setup for my website.

Post by califdon »

saravanaprabhu wrote:I want to send email to users who register to my website.
Well, in order to send ANY email, it HAS TO be sent by an SMTP server, so the question is: WHAT SMTP server will you use? The normal process is to use the SMTP server provided by the hosting service, in which case (and assuming that you're using PHP) you just use the extremely simple PHP function mail(). That's covered in the reference that phphelpme gave you in his first response. That's why I asked you whether your site is hosted at a commercial hosting service, in which case you're probably covered, but the only way to know is to talk to your hosting service people. The other possibility would be to use a mailto: link in your HTML, which launches the user's local mail client software, ultimately sending the email via the SMTP server that the user normally uses to send their own emails. But that doesn't give your site any control over what is in the body of the message (as far as I know), so it surely wouldn't be appropriate for your purpose. Thus, we're back to your hosting service. Most every hosting service I know of provides an SMTP server, so all you need to do is use the mail() function in your script. But you see, without telling us how your site is hosted, all we can do is guess. Finally, if you are not sure about whether your hosting service provides an SMTP server, I will repeat, you must ask them.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Re: php mail setup for my website.

Post by Bill H »

But that doesn't give your site any control over what is in the body of the message (as far as I know)
You can control the message, but a mailto link would have the viewer sending the email, and I have the impression he wants the viewer receiving the message.

Code: Select all

<a href="mailto:whatever@email.com?subject=this is the subject&body=This is themessage">click here</a>
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: php mail setup for my website.

Post by califdon »

Ah, yes. I guess I was thinking of the case where the site is hosted on one's own local computer, using a DSL Internet connection with a web server installed, but not a mail server. Highly unlikely and not a good idea either. Thanks for reminding me of the possibility of specifying the body in a mailto:, but use of mailto: is surely not appropriate here. Assuming that the site is hosted somewhere, there is no doubt an SMTP server that permits PHP to send emails with the mail() function.
Post Reply