SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Hyperlink in html email not working as intended

    Hi,

    I am doing something like the email system. Right now, I need to send an html email with a hyperlink.

    All goes well, except that the hyperlink address in the emails (during my trial runs) show this:

    http://mail.yahoo.com/config/login?/ \"http://www.example.com\"

    Upon clicking this link, the portion in red will always prompt for the yahoo! login in id and password, instead of directing the reader to the link http://www.example.com

    May I know how can I get rid of the unnecessary red portion?

    My code is:

    <script language="JavaScript" type="text/javascript">
    <!--
    //Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
    writeRichText('standard_reply', '<p>Dear <?=$job_title;?> <?=$author;?>,</p><p>&nbsp;</p><p>Thank you for your submission.</p><p>Please see our website</p><p><a href="http://www.example.com/" target="_blank">Example webpage</a></p>', 520, 300, true, false);
    //-->
    </script>



    This is the function writeRichtext:

    function writeRichText(rte, html, width, height, buttons, readOnly) {
    if (isRichText) {
    if (allRTEs.length > 0) allRTEs += ";";
    allRTEs += rte;
    writeRTE(rte, html, width, height, buttons, readOnly);
    } else {
    writeDefault(rte, html, width, height, buttons, readOnly);
    }
    }


    Please refer to this site http://www.kevinroth.com/rte/demo.htm

    I am developing an email sys, using this sample.

    The hyperlink is a default statement inside the textarea.

    Any advise is most appreciated.

    Thanks for reading.
    Regards,
    Junk

    I am never more keen to learn...

  2. #2
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you set the MIME-Version? I think that might help.

    try something like this:
    PHP Code:
    // I found this script at http://us2.php.net/manual/en/function.mail.php

    /* recipients */
    $to  "recipient@domain.com";

    /* subject */
    $subject "Email Subject";

    /* message */
    $message = <<<HERE
    <html>
    <head>
     <title>Title</title>
    </head>
    <body>

    Hey 
    $name, this is your email
    <a href="http://www.example.com/">My Site

    </body>
    </html>
    HERE;

    /* To send HTML mail, you can set the Content-type header. */
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    /* additional headers */
    $headers .= "From: Who is email from<you@example.com>";

    /* and now mail it */
    if ($_GET['send'] == 'yes')
    {
        
    mail($to$subject$message$headers);

    I hope this helps
    Busch

  3. #3
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your advise.

    Merry Christmas!

    I am calling a function send email. $message_post (html) is one of the parameters. Now, heeding your advise, I tried to combine this with the hyperlink.

    <?php
    function send_email($to_addr,$cc_addr,$bcc_addr,$subject,$message_post)
    {
    //input variables
    $from_addr = "s8201865d@ntu.edu.sg";
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Cc: $cc_addr\r\n";
    $headers .= "Bcc: $bcc_addr\r\n";
    $message = $message_post;
    $message .= <<<HERE
    <html>
    <head>
    <title>Title</title>
    </head>
    <body>

    Hey $name, this is your email
    <a target="_blank" href="http://www.yahoo.com" >Yahoo! Webpage</a>

    </body>
    </html>
    HERE;


    $path_to_sendmail = "/usr/sbin/sendmail";
    $fp = popen("$path_to_sendmail -Am -t", "w");

    $num = fputs($fp, "From: $from_addr\n");
    $num = fputs($fp, "To: $to_addr\n");

    $num += fputs($fp, "Subject: $subject\n");
    $num += fputs($fp, "$headers\n\n");
    $num += fputs($fp, "$message\n\n");


    pclose($fp);

    //return infomation
    if ($num > 0) {
    echo "Your mail has been sent out!";}
    else { echo "Error!";} ?>


    There is an error when I run this code.

    Where has it gone wrong?

    Pardon me for limited knowledge for PHP.
    Regards,
    Junk

    I am never more keen to learn...

  4. #4
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    opps, now I have removed this line

    Hey $name, this is your email

    as well. Error persist.
    Regards,
    Junk

    I am never more keen to learn...

  5. #5
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not quite sure what you are doing here:
    PHP Code:
     $path_to_sendmail "/usr/sbin/sendmail";
    $fp popen("$path_to_sendmail -Am -t""w");

    $num fputs($fp"From: $from_addr\n");
    $num fputs($fp"To: $to_addr\n");

    $num += fputs($fp"Subject: $subject\n");
    $num += fputs($fp"$headers\n\n");
    $num += fputs($fp"$message\n\n");


    pclose($fp); 
    so i cant help you with that. sorry.

  6. #6
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another query I have

    Recall my code (from above)

    <script language="JavaScript" type="text/javascript">
    <!--
    //Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
    writeRichText('standard_reply', '<p>Dear <?=$job_title;?> <?=$author;?>,</p><p>&nbsp;</p><p>Thank you for your submission.</p><p>Please see our website</p><p><a href="http://www.example.com/" target="_blank">Example webpage</a></p>', 520, 300, true, false);
    //-->
    </script>


    I intend to do this for the line in bold, so that I can easily alter this.

    $reply_sms = "<p>Dear <?=$job_title;?> <?=$author;?>,</p><p>&nbsp;</p><p>Thank you for your submission.</p><p>Please see our website</p><p><a href="http://www.example.com/" target="_blank">Example webpage</a></p>"

    However, after the // the rest becomes comment. How do I combat this problem.

    Thanks!
    Regards,
    Junk

    I am never more keen to learn...

  7. #7
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Busch,

    thanks for your fast reply.

    Actually I am sending an email using that code.

    So, do you mean that the code(I mentioned above) will work if I use the mail( ); function?

    Thanks!
    Regards,
    Junk

    I am never more keen to learn...

  8. #8
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it should work. I don't know how javascript will work though if that is sent via mail(). try it and let me know how it goes.

  9. #9
    SitePoint Zealot Junk's Avatar
    Join Date
    Dec 2004
    Location
    Asia
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, the challenge now is, I cannot get function mail ( ); to deliver. Email can only be sent using this method:

    $path_to_sendmail = "/usr/sbin/sendmail";
    $fp = popen("$path_to_sendmail -Am -t", "w");

    $num = fputs($fp, "From: $from_addr\n");
    $num = fputs($fp, "To: $to_addr\n");

    $num += fputs($fp, "Subject: $subject\n");
    $num += fputs($fp, "$headers\n\n");
    $num += fputs($fp, "$message\n\n");


    pclose($fp);

    I am lost and confused... sigh..
    Regards,
    Junk

    I am never more keen to learn...


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
  •