Page 1 of 1
php mail setup for my website.
Posted: Sun Aug 28, 2011 12:45 pm
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.
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 12:54 pm
by phphelpme
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 1:00 pm
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.
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 1:03 pm
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
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 1:30 pm
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.
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 1:37 pm
by saravanaprabhu
I want to send email to users who register to my website.
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 2:06 pm
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
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 2:13 pm
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
Re: php mail setup for my website.
Posted: Sun Aug 28, 2011 8:55 pm
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.
Re: php mail setup for my website.
Posted: Mon Aug 29, 2011 11:13 am
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>
Re: php mail setup for my website.
Posted: Mon Aug 29, 2011 11:53 am
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.