how to send an email from localhost xampp?? anyone give me a proper procedure... i'm confused.

Recommended Answers

All 7 Replies

8e03ef12100d6d855f3b5bc377d8310d @ pritaeas & @rofus : its working. but i want to send whole php (it pulls some records from mysql) page to client email id. how to change subject and how to pass it?

Member Avatar for diafol

Paste your code and show the data you want to send.

What'sthe problem in that, before constructing message body for mail fetch data from database append it in message and send mail.

@ diafol :

<?php
include("config.php");
if(isset($_GET["id"]))
{
    $id = mysql_real_escape_string($_GET["id"]);
    $query = mysql_query("SELECT * FROM ebvouchers WHERE VoucherID = $id");
    $row = mysql_fetch_object($query);
    echo mysql_error();
}
?>
<?php
      <tr>
        <td height=40 class=detailsfont>Name of Guest :</td>
        <td class=fetchfont>$row->GuestName</td>
        <td class=detailsfont>Phone Number of Guest : </td>
        <td class=fetchfont>$row->GuestPhone</td>
      </tr>
      <tr>
        <td height=40 class=detailsfont>Booking Date :</td>
        <td class=fetchfont>$row->BookingDate</td>
        <td class=detailsfont>Guest Email ID : </td>
        <td class=fetchfont>$row->GuestEmail</td>
      </tr>
?>

i want to fetch some datas from mysql and send an email to customer. here i can fetch the data perfectly based on a user id. how can i send those mysql datas through email... i tried it. but i received html fields only. i didn't get mysql records...

email.php

$body             = file_get_contents('sendemail.php');
Member Avatar for diafol
<?php
      <tr>
        <td height=40 class=detailsfont>Name of Guest :</td>
        <td class=fetchfont>$row->GuestName</td>
        <td class=detailsfont>Phone Number of Guest : </td>
        <td class=fetchfont>$row->GuestPhone</td>
      </tr>
      <tr>
        <td height=40 class=detailsfont>Booking Date :</td>
        <td class=fetchfont>$row->BookingDate</td>
        <td class=detailsfont>Guest Email ID : </td>
        <td class=fetchfont>$row->GuestEmail</td>
      </tr>
?>

I'm surprised that you didn't get an error. There's no parsing going on...

<?php
$str = "<tr>
        <td height='40' class='detailsfont'>Name of Guest :</td>
        <td class='fetchfont'>{$row->GuestName}</td>
        <td class='detailsfont'>Phone Number of Guest : </td>
        <td class='fetchfont'>{$row->GuestPhone}</td>
      </tr>
      <tr>
        <td height='40' class='detailsfont'>Booking Date :</td>
        <td class='fetchfont'>{$row->BookingDate}</td>
        <td class='detailsfont'>Guest Email ID : </td>
        <td class='fetchfont'>{$row->GuestEmail}</td>
      </tr>";

echo $str;      
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.