Re: Mail function
| From: | Shafiq Rehman | Date: | Thu, 05 Apr 2007 06:26:30 +0000 |
| Subject: | Re: Mail function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252073@lists.php.net to get a copy of this message | ||
Hi,
What i understand is, you have written a new function for sending emails.
Are you passing all the variables to that function? If not, you have to
pass.
or you can use my function
<?php
// function declaration, This function can send only HTML emails
function sendMail ($toEmail, $subject, $message, $fromName, $fromEmail)
{
$header .= "From: $from_name <$fromEmail>\n";
$header .= "Reply-To: <$fromEmail>\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-type: text/html; charset=us-ascii; format=flowed\n";
$header .= "Content-Transfer-Encoding: 7bit\n";
$header .= "X-Mailer: php\n\n";
mail($toEmail, $subject, $message, $header);
}
// variable values and usage
$toEmail = "shafiq@shafiq.pk"; $subject = "Hello, This is test"; $message = "Hellow Shafiq, <br><br> This is testmessage<br><br>Regards<br>Shafiq";
$fromName = "Sender Name"; $fromEmail = "you@yourdomain.com";sendMail ($toEmail, $subject, $message, $fromName, $fromEmail); ?> -- Shafiq Rehman (ZCE) http://www.phpgurru.com | http://shafiq.pk On 4/5/07, Zhimmy Kanata <kanata_zhimmagish@yahoo.ca> wrote: > > Hi, > > I am working on a program to create a registration feature through a > email notificaiton much like this list. For functional use but also for > personal training. > > However, I can't seem to pass the variable into the mail function() ? If > I echo the variable it displays it so it must be passing the variable down. > If I enter in a fixed and workable email address where $email is then it > works as well. So I am a little confused to this problem. I have other > programs where I do this but I place the mail function within a new > function(). However, when I do that it just barks back at me. Contacted my > Hosting company they are investigating. > > Thanks in advance for your help... > > Here is the code.. > > echo "$email"; > echo "Thanks for registering! <----- It does echo it. > You will recieve an email shortly containing your validation code, > and a link to activate your account!"; > > > mail($email, "New Registration, www.sitename.com", " > Thanks for registering on SITE NAME. > Here are your login details: > > Username: ".$username." > Password: ".$password." > > In order to login and gain full access, you must validate your > account. > > Click here to validate: > > http://www.sitename.com/login/register.php?action=activate&user= > ".$username."&code=".$activation_code." > > Thanks! > > [Webmaster] > "); > > I got the code from www.avengingsorrow.com to see all the code. > > Sorry about the HTML email. I am new to the list (first post) and I > don't believe you can turn off HTML email in Yahoo. > > Thanks again in advance > > Zhimmy > > > --------------------------------- > Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger > with Voice