Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2003, 03:58 PM
Registered User
 
Join Date: Dec 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default help in mail()

hi everyone,

      i need help in writing a code to perform a mailing action of values stored in 2 variables . the mail function narmally has
mail( to, " sub", from) but i need to send values from 2 variables selected dynamically from the previouspage and mailed using the mail function written in this page.
now my question is can mail function take variable values more than one and how to declare the variables in this page connecting to the form they are in.I hope u understand what i am trying to tell.
you can understand what i am talking if u see the page i designed.i have written the mail action in asp. I dont know how to do it in php as the server does not support asp.

http://www.frictioncenter.com/Pages/date_picker1.php
AND PLZ MAIL ME AT [email protected]
CAN SOMEBODY PLEASE WRITE THE CODE FOR THE MAIL PAGE WITH THE SAME VARIABLE NAMES I USED IN ASP.
THE ASP CODE FOR THE MAILING PAGE IS AS BELOW:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 5.0">
</HEAD>
<BODY>

<P>&nbsp;</P>

<form id=form1 name=form1>
<%
dim comDate
dim comName
comDate = Request.Form("hdndate")
comName = Request.Form("hdnComName")
'Response.Write (comName)
'Response.End
    Set MyMail = Server.CreateObject("CDONTS.NewMail")
                MyMail.From = "[email protected]"
                MyMail.To = "[email protected]"
                MyMail.Subject = "hi Admin"
                MyMail.Body = comName & " is registered by xyz on " & comDate
                MyMail.Send
                Set MyMail = Nothing
                Response.Write "You have registered succesfully. Please contact Admin"

%>
</form>
</BODY>
</HTML>


 
Old December 15th, 2003, 04:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PHP's mail() function is documented here:
 http://www.php.net/function.mail

mail()'s parameters are <to>, <subject>, <message>.

That said, you're PHP code should be something like:

<?php

$from = "[email protected]";
$to = "[email protected]";
$subject = "hi Admin";
$msg = "{$_POST['comName']} is registered by xyz on {$_POST['comDate']}";

mail($to, $subject, $msg, "From: {$from}");

echo "You have registered successfully. Please contact Admin";

?>


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.