SMTP

the mail() function

Moderators: macek, egami, gesf

NinJaSkrtel
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Aug 28, 2011 2:56 am

SMTP

Postby NinJaSkrtel » Sun Aug 28, 2011 2:59 am

Having trouble with smtp on a php form. Here is the code:

// specify main and backup server
$mail->Host = "I'VE PUT MAIN DOMAIN SERVER HERE";

// turn on SMTP authentication
$mail->SMTPAuth = true;
// SMTP username
$mail->Username = "I'VE PUT EMAIL USERNAME HERE";
$mail->Password = "I'VE PUT EMAIKL PASSWORD HERE";
$mail->From = $mail->Username;
$mail->FromName = "From Name";
// Email address on which you wish to collect contact information from your site form.
// name is optional
$mail->AddAddress("I'VE PUT EMAIL ADDRESS HERE", "name");
// User will be redirected to this URL after submitting the form.
$redirect_url = "success.htm";
// set word wrap to 50 characters
$mail->WordWrap = 50;

// set email format to HTML
$mail->IsHTML(true);


$name = check_input($_POST['name'], "Enter your name, it is mandatory. Click the back button on your browser and fill in the required fields.");
$email = check_input($_POST['email'], "Enter your email address, it is mandatory. Click the back button on your browser and fill in the required fields.");
$phone = check_input($_POST['phone']);

function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
die($problem);
}
return $data;
}
header('Location: success.htm');


?>

When submit is selected, it does go through to the 'success' page, but mails are not being delivered. Any advice?

User avatar
bigjoe11a
New php-forum User
New php-forum User
Posts: 137
Joined: Wed Aug 31, 2011 3:55 am
Location: USA
Contact:

Re: SMTP

Postby bigjoe11a » Wed Aug 31, 2011 4:13 am

Since you didn't include the class your using. Your code above doesn't have the New Object even set.
In your case it would be some thing like this

$mail = new Sendmail("host","user","pw");
$mail->SMTPAuth = true;

How ever. You should just use the PHP Send Mail. All so check your spam folder too. and your SMTP logs and make sure your not getting any errors when the message is getting sent.

Try posting the class object your using.

Joe


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron