Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Unable to send mail

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #146214
    iamRDM
    Participant

    I’m having a billing php script which has a feature of sending email to clients directly through it. But I’m not able to send email. I’m using godaddy and using wordpress on the same server but it can send emails..

    Please tell me is there any way to make it work.

    #146315
    Anonymous
    Inactive

    @iamRDM
    Try this: http://www.w3schools.com/php/php_mail.asp
    and if error will be show read it and write here

    #146321
    chrisburton
    Participant

    W3Schools isn’t reliable. If there’s a PHP error, you should see it.

    Please post your code, removing sensitive info, first.

    #146397
    iamRDM
    Participant

    @traq I’m hosted with godaddy and the script is using geekmail.php for sending emails.
    and this is the page which has the email feature.

    <?
    $res=mysql_query(“select * from invoices where id='”.$_SESSION[‘invoice’].”‘”)or die(mysql_error());
    $info=mysql_fetch_array($res);
    if(isset($_POST[‘sendinvoice’])){
    $to=$_POST[‘to’];
    if($to==”){
    echo “

    Please enter a valid Email

    “;
    }else{
    $subject=$_POST[‘subject’];
    $message=$_POST[‘message’];
    $_GET[‘id’]=$_SESSION[‘invoice’];
    include “inc/invoice_save.php”;

            $invoiceloc=str_replace(array('inc','mobile/'),'',dirname(__FILE__))."inc/invoices/".$_SESSION['invoice'].".pdf";
            if(mailer($to,$subject,$message,$invoiceloc)){
                echo "<div>Email has been Sent</div>";
            }else{
                echo "<div>Oops! Something went wrong!</div>";
            }
        }   
    

    }

    ?>

    <table align=’center’ style=’margin-top:40px; margin-bottom:40px;’>
    <tr>
    <td class=’alldone’ onclick=”window.open(‘inc/invoicepdf.php?id=<?=encrypt($_SESSION[‘invoice’].”-“.md5($_SESSION[‘invoice’]))?>’)”><br>Download PDF</td>
    <td class=’alldone’ onclick=”window.open(‘inc/invoicehtml.php?id=<?=encrypt($_SESSION[‘invoice’].”-“.md5($_SESSION[‘invoice’]))?>’)”><br>View HTML</td>
    </tr>
    <tr>
    <td class=’alldone’ colspan=’2′ onclick=”$(‘#emailtoclient’).slideDown(); $(‘html, body’).animate({scrollTop: 300}, 1000);”><br>Send as Attachment via Email</td>
    </tr>
    </table>

    <form action=” method=’post’>
    <table width=’310′ style=’background:#fff; display:none;’ align=’center’ id=’emailtoclient’>
    <tr>
    <td>Subject:</td>
    <td><input type=’text’ class=’settings’ style=’width:235px;’ name=’subject’ value=’Invoice #<?=$_SESSION[‘invoice’]?> from <?=$cfg[‘name’]?>’></td>
    </tr>
    <tr>
    <td>To:</td>
    <td><input type=’text’ class=’settings’ style=’width:235px;’ name=’to’ value='<?=$info[‘client_email’]?>’></td>
    </tr>
    <tr>
    <td colspan=’2′><textarea class=’settings’ name=’message’ style=’widtH:300px; height:200px;’>Dear <?=$info[‘client_name’]?>,
    We have attached an invoice in the amount of <?=$info[‘total’]?><?=$info[‘currency’]?>.

    You may pay, view and print the invoice online by visiting the following link:
    http://&lt;?=$_SERVER[‘HTTP_HOST’]?><?=str_replace(‘add.php’,”,$_SERVER[‘SCRIPT_NAME’])?>inc/invoicehtml.php?id=<?=encrypt($_SESSION[‘invoice’].”-“.md5($_SESSION[‘invoice’]))?>
    Best Regards,
    <?=$cfg[‘name’]?>
    </textarea></td>
    </tr>
    <tr>
    <td colspan=’2′ align=’center’><input type=’submit’ name=’sendinvoice’ class=’button’ value=’Email invoice to Client’/></td>
    </tr>
    </table>
    </form>

    #146456
    iamRDM
    Participant

    @tarq it says “oops something went wrong”

    And I tried that “the php manual” it worked like a charm.

    And about that php.ini file I’ll check n post it within a while.

    #146602
    iamRDM
    Participant

    the manual was useful
    but my script isn’t working.
    this is the code of page which has email feature http://pastebin.com/k9d89c9v

    and this is the link of email script http://pastebin.com/YbnU0zQk i.e. geekmail

    #146664
    iamRDM
    Participant

    it sends the invoice information to my customers

    #146679
    iamRDM
    Participant

    error_reporting(0);
    @include “db.php”;
    @include “geekmail.php”;
    $res=mysql_query(“select * from config”)or die(mysql_error());
    while($row=mysql_fetch_array($res)){
    $cfg[$row[‘name’]]=$row[‘value’];
    }
    session_start();

    function mailer($to,$subject,$message,$attach=”){
    global $cfg;
    $geekMail = new geekMail();
    $geekMail->setMailType(‘html’);
    $geekMail->from($cfg[’email’], $cfg[‘name’]);
    $geekMail->to(array($to));
    $geekMail->subject($subject);
    $geekMail->message(nl2br($message));
    if($attach){
    $geekMail->attach($attach);
    }
    if (!$geekMail->send())
    {
    return 0;
    }else{
    return 1;
    }
    }

    #146681
    iamRDM
    Participant

    I’m unable to find the php.ini file :(
    where is it located in godaddy shared linux hosting any idea ?

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.