PHP email function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • roger.rigsby@gmail.com

    #1

    PHP email function

    I have a working email functionality on my site but there's a problem
    with links. I really want to use the "send this article by email" sort
    of functionality on my site. But instead of emailing the entire
    article I just want the email to include a link to the article and
    ofcourse with query strings and all that sort of stuff the link could
    be quite long. In an attempt to make the links look good and mask all
    of the details I include the link in an html tag, so a very simple < a
    href = " wwwwww.whatever t....com " > Click here < /a >

    The problem is that it doesn't work the HTML code doesn't work in
    emails. What's the solution. I even tried typing out an html coded
    email using my email client and that didn't work so I guess there's
    just an issue with email and html.

    Anybody know a solution to sending a link via email (using PHP) and
    using HTML or whatever so that the entire link isn't visible just the
    CLICK here part?


    Thanks

    r

  • John Dunlop

    #2
    Re: PHP email function

    roger.rigsby@gm ail.com:
    [color=blue]
    > I have a working email functionality on my site but there's a problem
    > with links. I really want to use the "send this article by email" sort
    > of functionality on my site. But instead of emailing the entire
    > article I just want the email to include a link to the article and
    > ofcourse with query strings and all that sort of stuff the link could
    > be quite long. In an attempt to make the links look good and mask all
    > of the details I include the link in an html tag, so a very simple < a
    > href = " wwwwww.whatever t....com " > Click here < /a >
    >
    > The problem is that it doesn't work the HTML code doesn't work in
    > emails. What's the solution. I even tried typing out an html coded
    > email using my email client and that didn't work so I guess there's
    > just an issue with email and html.[/color]

    I would agree that there is an issue with HTML in e-mails. There is
    a body of opinion that says that e-mail and HTML don't click. They
    don't get on. Assuming you have considered this...

    Couple of questions. Is the Content-Type of the body part set to
    text/html? That is, have you told the mail client what format the
    message is in? Does the user-agent support, and is it configured to
    interpret HTML mail?

    One of the design principles of URLs is that they have fewer than ~70
    characters, so that they fit on a single line in, for example, e-mails.
    Are you perhaps addressing the symptom rather than the cause?

    --
    Jock

    Comment

    • roger.rigsby@gmail.com

      #3
      Re: PHP email function

      ^you are on to something.

      I think the content-type is the culprit, but i'm at a lose as to how to
      incorporate the content-type into the mail function.

      here's my code
      mail($EmailTo, $Subject, $Body, "From: '$SName' <$EmailFrom>" );

      where would conent type go? as one of the headers or within the body?

      Comment

      • Krustov

        #4
        Re: PHP email function

        <comp.lang.ph p>
        <>
        <28 Jun 2006 07:36:58 -0700>
        <1151505418.665 402.149790@b68g 2000cwa.googleg roups.com>
        [color=blue]
        > I have a working email functionality on my site but there's a problem
        > with links. I really want to use the "send this article by email" sort
        > of functionality on my site. But instead of emailing the entire
        > article I just want the email to include a link to the article and
        > ofcourse with query strings and all that sort of stuff the link could
        > be quite long. In an attempt to make the links look good and mask all
        > of the details I include the link in an html tag, so a very simple < a
        > href = " wwwwww.whatever t....com " > Click here < /a >
        >[/color]

        Have you asked people if they want a html (Click here) link instead of a
        plain text link ? .


        --

        Comment

        • rojelio@gmail.com

          #5
          Re: PHP email function

          ^
          they definitely want a clickable link instead of the full url path.
          but in the end if I can't get this clickable link to work i'll just
          have to do it as text. Although that even rises a problem. When the
          email displays the a href html tag it reads part of the url and makes
          it a hyper link.... but the url has spaces in it....(I know not my
          doing but there are spaces) there fore it makes the conjoined part of
          the url a link and leaves everything after the space regular text and
          that looks worse than if it were all just regular text.

          Comment

          • Deano

            #6
            Re: PHP email function


            rojelio@gmail.c om wrote:[color=blue]
            > ^
            > they definitely want a clickable link instead of the full url path.
            > but in the end if I can't get this clickable link to work i'll just
            > have to do it as text. Although that even rises a problem. When the
            > email displays the a href html tag it reads part of the url and makes
            > it a hyper link.... but the url has spaces in it....(I know not my
            > doing but there are spaces) there fore it makes the conjoined part of
            > the url a link and leaves everything after the space regular text and
            > that looks worse than if it were all just regular text.[/color]

            Try using the php mail class, it has options for specifing html and an
            alternate for non html recipients (can't remeber how this works
            multipart/alternative header to the message I think??) it also has a
            load of other useful bits and pieces in it which makes it a little more
            secure and basically more useful than using php's mail() alone

            You can find it here: http://phpmailer.sourceforge.net/

            Deano

            Comment

            • John Dunlop

              #7
              Re: PHP email function

              Deano:
              [color=blue]
              > Try using the php mail class, it has options for specifing html and an
              > alternate for non html recipients[/color]

              Not convinced this is useful, in general. I think it would be better
              to find out what format the person prefers to receive e-mails in and
              send their e-mails in that format only. For example, you could default
              to text/plain and have an opt-in option for text/html.

              --
              Jock

              Comment

              • John Dunlop

                #8
                Re: PHP email function

                roger.rigsby@gm ail.com:
                [color=blue]
                > I think the content-type is the culprit, but i'm at a lose as to how to
                > incorporate the content-type into the mail function.[/color]

                As an additional header.



                --
                Jock

                Comment

                • roger.rigsby@gmail.com

                  #9
                  Re: PHP email function

                  ^thnx, i'll try this out

                  the php mail class seems a bit too complicated and long for the simple
                  function I want

                  gratzi

                  Comment

                  • roger.rigsby@gmail.com

                    #10
                    Re: PHP email function

                    it worked thanks Jock

                    woohoo

                    Comment

                    Working...