2bigpigs Posted October 14, 2011 Posted October 14, 2011 I have my own scripts for registration/validation. I've only used it on WAMP on my local machine with it's PHP.ini configured to use sendmail. so it's been a simple use of the mail() function. I have my heliohost email accounts setup. How would i go about using them to mail? You don't have to go into TOO much detail. Thanks in advance. PS: I'm new to webhosting so i'm unfamiliar with a lot of things. Just got my account queued yesterday and i've run CPanel once. My site isn't up yet but it will be today
Krydos Posted October 14, 2011 Posted October 14, 2011 Here's a nice php example using mail() that byron posted a while back that has some lovely regexp for deciding valid email addresses or not. http://helio.byrondallas.heliohost.org/email_form.txt
2bigpigs Posted October 15, 2011 Author Posted October 15, 2011 Cool thanks. One more question: What email account would the mail be sent from? Does it need authentication (how do i do it, if it needs), do i have to configure it in cpanel? Any special settings to check? I have my code down now, My site still isn't up so i figured i'd ask now so i waste not time getting it up.
Krydos Posted October 15, 2011 Posted October 15, 2011 What email account would the mail be sent from? It would be sent from whatever email address you typed into this variable. ######################################## ##### CHANGE TO YOUR EMAIL ADDRESS ##### $to = "your_email@yahoo.com"; As far as settings, nothing special really. You could use a heliohost email or some other account.
2bigpigs Posted October 15, 2011 Author Posted October 15, 2011 Kinda goes against the logic of calling it '$to' doesn't it? Also, It's a contact us form so i'd expect the message to come to MY email ID rather than from it... Yes, I'd like use heliohost's email. I just need to know whether i have to configure something to use a certain email by default or something. And, more importantly, whether it would need authentication.
Krydos Posted October 15, 2011 Posted October 15, 2011 Kinda goes against the logic of calling it '$to' doesn't it? I think you haven't actually looked at the script, or clearly don't understand it. $to is the email address that the email gets sent to. Hence, it's perfectly named. Also, It's a contact us form so i'd expect the message to come to MY email ID rather than from it... Yes, it's a contact form. Visitors to this form would be wanting to contact you (or the owners of the website) and send them feedback by typing it into the form and hitting submit. Then the stuff they typed in would be emailed to the email address that you set in the $to variable. The user of the form doesn't ever necessarily even have to see what email address they are sending the info to or whether the form is just dumping it in a file somewhere. Yes, I'd like use heliohost's email. I just need to know whether i have to configure something to use a certain email by default or something. Yes, you would have to change the $to line to the email account you want to use. And, more importantly, whether it would need authentication. I guess that really just depends a lot on the email address you use. I think you're getting too hung up on the specifics of this particular script. I didn't write it. I don't really care if all the variables exactly how you want them. You asked for an example of how to send an email through php using the mail() function and I linked a premade example that I thought was a great example BECAUSE it has that amazing regular expression. Regexp can be rather annoying to write yourself so this example stuck in my mind. Once again, if something isn't the way you want it just change it so it suits your needs. Ah ha, I also just realized that I misread your post earlier slightly. The from address never really matters on scripts like this. It's more of just a where can I reply to you at? $email = $_POST['email']; The user of the form fills out the 'from' themselves, but like I said feel free to change as needed.
Byron Posted October 15, 2011 Posted October 15, 2011 The php mail() function doesn't require you to set up any email account at your cpanel. It automatically sends the mail through the mail server using your username. If you looked at the email headers from the email being sent it would show something like this: from: user_name@stevie.heliohost.org user_name would be your username. No matter what you specified in the mail function $to and $from, the email headers would show this for tracking purposes.
2bigpigs Posted October 17, 2011 Author Posted October 17, 2011 Thanks, I'm new to webhosting and the only previous experience i've had with php mailing is using sendmail. This is really easy now. I'm glad i found heliohost Krydos, You did misread it. And, sorry if i sounded a bit cocky
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now