Web Page Designing

black

Active member
  • Oct 12, 2006
    672
    119
    43
    37
    The Freedom Country...
    http://postimage.org/

    මේ ‍පොටෝ එකේ submit ක්ලික් කලාම අපිට ඕනි ඊ‍මේල් එකකට මෙතන ටයිප් කරන ඇඩ්රස් එක send වෙන්න හදන්නෙ කොහොමද??

    Pls help:sorry:


    මේ තියෙන්නෙ එතන තියෙන coding ටික

    http://postimage.org/
     
    Last edited:

    black

    Active member
  • Oct 12, 2006
    672
    119
    43
    37
    The Freedom Country...
    මචං මං මේ නිකං පුරැදු වෙන්න template එකක් අරන් notepad එකේ edit කලේ. මං මේවා ගැන වැඩිය දන්නැහැනෙ
     

    kasuwa1235

    Well-known member
  • Dec 17, 2007
    6,353
    91
    48
    gampaha
    මචං මං මේ නිකං පුරැදු වෙන්න template එකක් අරන් notepad එකේ edit කලේ. මං මේවා ගැන වැඩිය දන්නැහැනෙ

    Mail Ekak yana vidiyata hadanna nam Mail Server ekak onine
     

    programmer98

    Member
    Aug 7, 2016
    232
    39
    0
    Sri Lanka
    හරි විදියට mail යවන්න නම් SMTP use කරන්න ඕන. එත් ඔකේ mail එක යන්නේ එකම address එකකට නිසා සරලව php mail() function එකෙන් කරගන්න පුළුවන් වෙයි.

    Step 1:
    PHP file එකක් හදා ගන්න මොකක් හරි නමකින්. ex: sendmail.php

    දැන් මේ code කෑල්ල දාන්න.


    Code:
    [FONT=Tahoma][SIZE=2]<?php
    [/SIZE][/FONT][FONT=Tahoma][SIZE=2][FONT=Tahoma][SIZE=2]// Check incomming request
    [/SIZE][/FONT]if(isset($_GET['email'])) {[/SIZE][/FONT][FONT=Tahoma][SIZE=2][FONT=Tahoma][SIZE=2]
    
    $msg =  [/SIZE][/FONT][/SIZE][/FONT][FONT=Tahoma][SIZE=2]$_GET['email'];[/SIZE][/FONT][FONT=Tahoma][SIZE=2] 
    
    // send email
    mail("YOUR_EMAIL_ADDRESS","EMAIL_SUBJECT",$msg);
    
    echo "mail send";
    [/SIZE][/FONT] } else {
    
    die();
    
    }
    [FONT=Tahoma][SIZE=2]?>[/SIZE][/FONT]




    Step 2:
    දැන් ඔයාගේ ඔය දාල තියෙන කෝර්ඩ් එකේ,
    ...
    <form action="#" method="get" id="subscribe">
    ...
    මෙතනට කලින් හදාගනිපු php file name එක දෙන්න.

    ...
    <form action="sendmail.php" method="get" id="subscribe">
    ...

    Step 3:

    දෙකම same directory එකකට upload කරලා test කරලා බලන්න.. මේ තියෙන සරලම ක්‍රමේ :rolleyes:
     

    black

    Active member
  • Oct 12, 2006
    672
    119
    43
    37
    The Freedom Country...
    tnx programmer98.

    මං අප්ලෝඩ් කරපු පොටෝ එකේ Your email කියලා තියෙන තැනට තමයි පේජ් එකට එන visitor එයාගේ ඇඩ්රස් එක දාන්නෙ. ඊට පස්සෙ එයා submit button එක ක්ලික් කරනවා.

    එතකොට ඔයා හදන්න කියපු php එකේ මගේ මේල් ඇඩ්රස් එක දාන්නෙ කොතනටද?
     
    Last edited:

    amiladash

    Member
    Feb 4, 2011
    51
    1
    0
    tnx programmer98.

    මං අප්ලෝඩ් කරපු පොටෝ එකේ Your email කියලා තියෙන තැනට තමයි පේජ් එකට එන visitor එයාගේ ඇඩ්රස් එක දාන්නෙ. ඊට පස්සෙ එයා submit button එක ක්ලික් කරනවා.

    එතකොට ඔයා හදන්න කියපු php එකේ මගේ මේල් ඇඩ්රස් එක දාන්නෙ කොතනටද?

    ඔයාගේ mail එක YOUR_MAIL_ADDRESS කියන තැනට දාන්න.
    ex :
    Code:
    mail("[email protected]","EMAIL_SUBJECT",$msg);
     
    Sep 18, 2009
    3
    0
    1
    Kalutara
    <?php
    if(isset($_POST['submit'])){
    $to = "[email protected]"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    }
    ?>

    <!DOCTYPE html>
    <head>
    <title>Form submission</title>
    </head>
    <body>

    <form action="" method="post">
    First Name: <input type="text" name="first_name"><br>
    Last Name: <input type="text" name="last_name"><br>
    Email: <input type="text" name="email"><br>
    Message:<br><textarea rows="5" name="message" cols="30"></textarea><br>
    <input type="submit" name="submit" value="Submit">
    </form>

    </body>
    </html>