Help - Search - Members - Calendar
Full Version: Send an Email via PHP
Hostony Board > General Support > PHP/MySQL
argiope
Hi All,

I am writing a script to send email to our service email through the web site...
a simple form mail thing.
All I need to know is which smtp I should use.

Could you give me a hint?

Best wishes.
romangs
did you try your domain name?
Stanly
Please use localhost as SMTP server.
Also you will need to use your username and password for your account to authorize at this SMTP.
casbboy
If you want to send it through PHP, just an easy way to go:

Lets assume your form has the following text fields: fullname, email, message, subject. The email textfield is the users submitted email. Lets say you wanted this email sent to you at your domain, like contact@yourdomain.com. Ok, the persons puts in his/her info, clicks submit, and the action takes her to a php file with this type of coding:

[php]
<?php
//MUST SETUP VARIABLES
$fullname = $_POST['fullname'];
$useremail = $_POST['email'];
$subject = $_POST['subject'];
$message= $_POST['message'];
$youremail = "contact@yourdomain.com";

//we just setup variables that hold the information inserted.

//Mail Program
$headers = "From: ". $fullname ."<". $useremail .">\r\n";

mail($youremail, $subject, $message,
$headers . phpversion());

//include a thank you page or something
include 'done.php';
exit();
?>
[/php]

That will send you a message to any email address you specify.

Ryan
MartinB
yes, here you have another example.
Danimal
That second one is nice and all, but the first one seems to let me send an email TO any address FROM any address. That's great for my blossoming SPAM company! WOO-HOO!*






*NOTE: I don't actually have a SPAM company, but that script seems to make it very easy to send phony emails.
MartinB
yes it is, but is traceable.
( ph34r.gif )
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here