We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,145 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

What features can I add to my email script?

<?php
require('class.phpmailer.php');
$mail=new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug=1;
$mail->SMTPAuth=true;
$mail->Port=465;
$mail->Host="ssl//smtp.gmail.com";
$mail->Host = "ssl://smtp.gmail.com";
if(isset($_GET['submit']))
{
	$mail->Username=check($_GET['UserName'],"user id  required");
	if(filter_var($_GET['UserName'],FILTER_VALIDATE_EMAIL)==false)
	{
	show_error("Invalid email address");
	}
	$mail->Username=$_GET['UserName'];

	$mail->Password=check($_GET['pass'],"password required");
	$con=check($_GET['conpass'],"confirm password required");
	if($con!=$mail->Password)
	show_error("Passwords do not match");
	$mail->FromName=check($_GET['name']);
	$_GET['rec']=check($_GET['rec'],"recipient required");
	if(filter_var($_GET['rec'],FILTER_VALIDATE_EMAIL)==false)
	{
	show_error("Invalid email address");
	}

	$_GET['recn']=check($_GET['recn']);
	$mail->AddAddress($_GET['rec'],$_GET['recn']);

	$mail->Subject=$_GET['sub'];
	$mail->Body =$_GET['body'];
	if ($mail->Send() == true) {
echo 'The message has been sent at '. time();
}
else {
echo 'The email message has NOT been sent for some reason. Please try again later.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
}
else
{
echo "<html>
<body bgcolor=#ECE5B6>
<center>
<h1>GMAIL PAGE</h1> 
<form action='email3.php' method='get'>
<table bgcolor=#ECD672>
<h2>
<tr><td style ='background-color :#ECD672'>Sender Email Address*: <td><input type='text' style ='background-color :#ECD672'name='UserName' /><br>
<tr><td style ='background-color :#ECD672'>Password*:<td> <input style ='background-color :#ECD672'type='password' name='pass' /><br>
<tr><td style ='background-color :#ECD672'>Confirm Password*: <td><input style ='background-color :#ECD672'type='password' name='conpass' /><br>
<tr><td>Name: <td><input type='text' name='name' /><br>
<tr><td style ='background-color :#ECD672'>ReceiverAddress*:<td> <input style ='background-color :#ECD672' type='text' name='rec' /><br>
<tr><td>ReceiverName:<td> <input type='text' name='recn' /><br>
<tr><td>Subject: <td><input type='text' name='sub' /><br>
<tr ><td valign='top' style='height:200 px'>Body: <td style='height:200 px'><input type='text' name='body' style='height:200 px'><br></h2>
</table>

<input type='hidden' name='submit' value='1' /><br>
<input type='submit' value='SEND EMAIL'/><br>
</center>
</form>

</body>
</html> 
";
}




function check($d,$prob='')
{
	$d=trim($d);
	$d=stripslashes($d);
	$d=htmlspecialchars($d);
	if($prob &&strlen($d)==0)
	{
		show_error($prob);
	}
	return $d;
}
function show_error($myError)
{

   echo " <html>
    <body>

    <b><h1><center>Please correct the following error:</b><br />";
  echo $myError;

echo "</center></h1>
    </body>
    </html>";

exit();


}
// function checke($d,$prob='')
// {
	// $d=trim($d);
	// $d=stripslashes($d);
	// $d=htmlspecialchars($d);
	// if(!preg_match($d,"^(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"))
	// {
		// show_error($prob);
	// }
	// return $d;
// }

?>



This is an email script I made using PHPMailer.Can soneone please suggest what features I can add and how?
Thanks Priteas in advance.
5
Contributors
13
Replies
22 Hours
Discussion Span
1 Year Ago
Last Updated
14
Views
swissknife007
Junior Poster in Training
75 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
Skill Endorsements: 0

Thanks Priteas in advance.

You have been summoned me old mucker!

Can soneone please suggest what features I can add and how?

What features are you looking for?

diafol
Keep Smiling
Moderator
10,662 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,513
Skill Endorsements: 57

Obviously, the thread is directed to our friend Priteas. Therefore, we aren't supposed to help ya in any way.. ROFL!

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

Obviously, the thread is directed to our friend Priteas. Therefore, we aren't supposed to help ya in any way.. ROFL!

@rotten:
Actually priteas helped me out with email script from the very beginning.....
I hadn't thanked him earlier so took this opportunity.
I respect everyone's opinions.
Your advice is more than welcome.

I would like to know whether how I can send the email to multiple recipients....
Also I am just a green horn in PHP ,I really don't what know kind of features are possible.
So I would appreciate your guidance on the same.And also the implementation part.

Thanks life,universe and everything.

swissknife007
Junior Poster in Training
75 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
Skill Endorsements: 0

@swissknife007.. Yeah, I ain't being against anyone here. I just pointed something out. By all means, I do respect all people in the forums.

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

@swissknife007.. Yeah, I ain't being against anyone here. I just pointed something out. By all means, I do respect all people in the forums.

So you do have something to suggest?

swissknife007
Junior Poster in Training
75 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
Skill Endorsements: 0

Abusive language??
'Me old mucker' ain't swearing- it's a term of endearment.

Downvoting me for your lack of understanding is funny. I asked a question so that I could try to help. It seems on Priaeas will do. Anybody else seems to get a downvote.

Seeing as you start more threads than do anything else, perhaps I need to...

...welcome you to the old ignore list.

diafol
Keep Smiling
Moderator
10,662 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,513
Skill Endorsements: 57

You aren't alone, ardav. I don't understand why I got downvoted for!!! haha it's too funny when one states facts that appear to be too obvious ;p

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

@swissknife.. NO, I do not want to suggest anything.

Good luck..

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

You can use AddAddress multiple times. Most other basic features can be found in this tutorial.

pritaeas
Posting Prodigy
Moderator
9,293 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,462
Skill Endorsements: 86

Great link:
hv

diafol
Keep Smiling
Moderator
10,662 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,513
Skill Endorsements: 57

I would like to know whether how I can send the email to multiple recipients....
Also I am just a green horn in PHP ,I really don't what know kind of features are possible.
So I would appreciate your guidance on the same.And also the implementation part.

Thanks life,universe and everything.

You can use AddAddress multiple times. Most other basic features can be found in this tutorial.

Also you can think of putting stuffs in loops

Stefano Mtangoo
Senior Poster
3,731 posts since Jun 2007
Reputation Points: 462
Solved Threads: 396
Skill Endorsements: 0

@ ardav... Thanks pal for sharing this website. I think it'll help many of us with how to ask proper questions and being nice to others ;p

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

@rotten69 - I got it from Pritaeas - he's got some cracking links in his sig.

diafol
Keep Smiling
Moderator
10,662 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,513
Skill Endorsements: 57

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1514 seconds using 2.74MB