Help a newbee save my job !

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
yustis
Forum Newbie
Posts: 2
Joined: Thu Oct 29, 2009 1:06 pm

Help a newbee save my job !

Post by yustis »

Hey guys i am dying here i am new to php and would like for someone to help me with this problem

i have a script that send information from a "form" but the probelm is that i need this to be autheticated (smtp) before sending the email.

here is the script that i am using: (If you know what i need to do to authenticate this smtp please HELP ME!)

<?php
$emailmanager = 'oscarm@crystalplace.com';

error_reporting(0);
$msg = '';
foreach ($_POST as $k => $v) { $msg .= $k.': '.$v."\n\n"; }

$email = trim($_POST['email']);
$Ok = ereg("^([a-zA-Z0-9_\.-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email);


$headers = 'From: ' . $email . "\n";
$headers .= 'MIME-Version: 1.0' ."\n";
$headers .= 'Content-Type: text/plain; charset=iso-8859-1' ."\n";
$headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";

if ($Ok) {
mail($emailmanager,'New Trade Form Request from Brilliante Crystal Cleaner',$msg,$headers);






?>
<script language = 'javascript'>
alert('Thank you For Submiting Your Application ---> Brilliante Crystal Cleaner Team <---');
window.close();
</script>
<?
} else {
?>
<script language = 'javascript'>
alert('Sorry, please complete the form.');
history.go(-1);
</script>
<?
}


?>
yustis
Forum Newbie
Posts: 2
Joined: Thu Oct 29, 2009 1:06 pm

Re: Help a newbee save my job !

Post by yustis »

Hey guys please help me with this thing its driving me nuts!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Help a newbee save my job !

Post by pickle »

Look into SwiftMailer - it might help.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Help a newbee save my job !

Post by Eric! »

Jackpf wrote a php mailer with authentication which should be easy for you to follow. He also has examples..see php mail class:
http://jackpf.co.uk/blog/Programming
Post Reply