SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am having a problem....

    I am setting up a database and have many articles. I have made it available to people to e-mail articles and am having a MAJOR problem.

    My e-mail setup is accessing my author, title, and date just fine, but then it seems to cut off my content part way through.... it seems to be by characters. But on my website it displayes everything just dandy. I do not have any delimiter set to only select a certain # of charachters.

    Here is my code to take the stuff from the database. The table and itemnumber variables are passed along in the URL.

    Code:
    // Select the database
    if (! @mysql_select_db("$database") ) {
    echo( "<P>Unable to locate the " .
    "database at this time.</P>" );
    exit();
    }
    
    $select = "SELECT DISTINCT ID, Content, Author, Title, Date";
    $from = " FROM $table";
    $where = " WHERE ID = $itemnumber";
    $results = mysql_query($select . $from . $where);
    $row = mysql_fetch_array($results);
    $content = $row["Content"];
    $firstauthor= $row["Author"];
    $title = $row["Title"];
    $date = $row["Date"];
    
    if ($firstauthor != ""){
    $author = "By $firstauthor";}
    
    else {
    
    $author = "";}
    ?>
    Here is my mail code... any light you can shed would be very appreciated.

    Code:
    mail("$recipient", "An Article From Beartooth Bullets Online", "This article has been forwarded to by $name <a href=\"$sender\">$sender</a><p>
    
    Comments from $name:<br> 
    $senderMsg<p>
    
    The original version of this article can be found at:<br>
    http://www.beartoothbullets.com/$folder<br>
    ------------------------<br>
    <font face=\"arial\"><b>$title</b></font><br>
    <font face=\"arial\" size=\"2\">$author</a><br>
    ------------------------<br>
    <font face=\"arial\" size=\"2\">$content</font><br>
    ------------------------<br>
    From Beartooth Bullets Online. Get many articles like this plus much more at Beartooth Bullets Online. <a href=\"http://www.beartoothbullets.com\">http://www.beartoothbullets.com</a><br>
    ------------------------<br>
    No part of this article can be used without the permission of Beartooth Bullets Online
    http://www.beartoothbullets.com", "From: $name <$sender>\r\nReply-to: $name <$sender>\r\nContent-Type: text/html");
    
    echo("<font size=\"2\" face=\"arial\">Thank You. Your message has been sent.<P>Want to send it to another person? <a href=\"$PHP_SELF?itemnumber=$itemnumber&table=$table\">Click Here</a></font><p><blockhead>
    <FORM><INPUT onclick=closeWindow(); type=button value=Close> </FORM></blockhead>");
    I have also tried it just plain text... and found the same problem....

    God Bless, and thanx for any help,

    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  2. #2
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that this is the problem:

    I found this comment at PHP.net for the function mail():

    <<Be careful - The mail function in PHP 4 doesn't seem to be able to send attachements larger that 2K.>>

    http://www.php.net/manual/en/function.mail.php

    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  3. #3
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But is the mail MESSAGE cosidered an attachment? I am just sending a plain message.... no attachments.

    It just seems to cut off my $content variable... nothing else. Any ideas?

    I am using the same format that kevin has in his tutorial. It seems to be cutting off the $content at about 904 carachters including spaces.
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  4. #4
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All strings you send using mail() are part of the email. We're not talking attachments here.

    Since $content is about the last variable you call in the function, only a part of it can be mailed due to this 2kb limit.
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also this line
    No part of this article can be used without the permission of Beartooth Bullets Online
    http://www.beartoothbullets.com", "From: $name <$sender>\r\nReply-to: $name <$sender>\r\nContent-Type: text/html");

    It seems you have some code strewn in the middle using "" without escaping them Where does it break right at the "From: line? Why is there more html after the From: It looks like you do use the headers option but you try to include html in the header param which To my knowledge shouldn't work
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok... well mabey I should ask another question then.

    What does a site like Webmaster Base use to send the Article. Some of those are very long, and I can still get them in there entirity.

    Any ideas for me? I just want to retrieve data from a MySQL based on ID then send that via e-mail to the address specified.

    God Bless, and thanx
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry about that, I just noticed that text afterward was confimration text regarding the email. My mistake. I have never had a problem sending email that long but I usually do something more like this
    $to = $recipient;
    $from = "From: $name <$sender>\r\nReply-to: $name <$sender>\r\nContent-Type: text/html";
    $subject = "An Article From Beartooth Bullets Online";
    $body .= "Some of the email and stuff";
    $body .= "Some more of the email";
    $body .= "Yet some more and son and so forth";

    mail($to, $subject $body, $from);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy: does that get around this 2K limit? That seems awfully small.

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chris I have never been faced with my email getting cut off, I had never even heard of the 2k limit before.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  10. #10
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still having problems! Any help would be greatly appreciated. I have tried many different versions of everything and am STILL having problems with my $content being truncated.

    Here is the code of exactly what I am using.
    Code:
    <?php
    $to = "me@mydomain.com"; 
    $header = "From: Alex Stanton <test@mydomain.com>\r\nReply-to: Alex Stanton <test@mydomain.com>\r\nContent-Type: text/html"; 
    $subject = "An Article From Beartooth Bullets Online"; 
    
    $user = "me";
    $pass = "myself";
    $database = "my_database";
    
    // Connect to the database server
    $dbcnx = @mysql_connect("localhost",
    "$user", "$pass");
    if (!$dbcnx) {
    echo( "<P>Unable to connect to the " .
    "database server at this time.</P>" );
    exit();
    }
    
    
    // Select the database
    if (! @mysql_select_db("$database") ) {
    echo( "<P>Unable to locate the " .
    "database at this time.</P>" );
    exit();
    }
    
    $select = "SELECT *";
    $from = " FROM tips";
    $where = " WHERE ID = 25";
    $results = mysql_query($select . $from . $where);
    $row = mysql_fetch_array($results);
    $body = $row["Content"];
    
    mail("$to", "$subject", "$body", "$header");
    echo("Message Has Been Sent");
    ?>
    This obviously has been changed some... my table and my ID are actually passed through the URL.....

    Thank You all for your help. Again... I have no clue why this is this way... It is a very odd thing.

    God Bless
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  11. #11
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It could be your Host, they could limit the characters ono the mail function...

    Just a though..

    I was working on this earlier today, and decided to make the reader come to my stie instead of sending the article in a email:

    example:

    http://www.codingclick.com/article.php?aid=2

    Click the Email Article link.....

  12. #12
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is all well and good... however... in my situation I really need to have the content of the message sent via e-mail.

    I wil contact my host and ask what's up.... it may be on there end.

    Thank you all, and keep throwing out idea!
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •