problem when sending mail

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • scott john

    problem when sending mail

    Hello

    Im trying to send a mail from a php-program. Im using a test program and the
    code for this is as follows:

    <?php
    $from = me@myaddress.co m";
    $subject = "Test";
    $to = 'me2@myaddress. com;
    $mailbody = 'mailbody';
    mail($to,$subje ct,$message,$fr om);
    ?>

    When I run the page/program I get the following error msg displayed:
    "Warning: Failed to Connect in G:\home\server\ users\me.com\cg i-bin\send.php
    on line 5"

    The mail is not delivered. I also tried with <> before and after the value
    in the $form. And, of course, the addresses are really ones and both are
    presents on the server. Does anyone know what the problem could be?

    <phpbeginner>


  • powerboy

    #2
    Re: problem when sending mail


    "powerboy" <powerboy@rarex treme.com> wrote in message
    news:3f46653d$0 $23613$5a62ac22 @freenews.iinet .net.au...[color=blue]
    > "scott john" <makkia55@hotma il.com> wrote in message news:avt1b.2091 9$mU6.32889@new sb.telia.net...[color=green]
    > > Hello
    > >
    > > Im trying to send a mail from a php-program. Im using a test program and the
    > > code for this is as follows:
    > >
    > > <?php
    > > $from = me@myaddress.co m";
    > > $subject = "Test";
    > > $to = 'me2@myaddress. com;
    > > $mailbody = 'mailbody';
    > > mail($to,$subje ct,$message,$fr om);
    > > ?>
    > >
    > > When I run the page/program I get the following error msg displayed:
    > > "Warning: Failed to Connect in G:\home\server\ users\me.com\cg i-bin\send.php
    > > on line 5"
    > >
    > > The mail is not delivered. I also tried with <> before and after the value
    > > in the $form. And, of course, the addresses are really ones and both are
    > > presents on the server. Does anyone know what the problem could be?
    > >
    > > <phpbeginner>[/color]
    >
    > Have you defined an SMTP server in php.ini ?[/color]

    Additionally, the $from variable must be a valid header, so change it to:

    $from = "From: me@myaddress.co m";

    You may also need to check which version of PHP you're using, since this header may not be honoured
    in your version.





    Comment

    • Shawn Wilson

      #3
      Re: problem when sending mail

      scott john wrote:[color=blue]
      >
      > Hello
      >
      > Im trying to send a mail from a php-program. Im using a test program and the
      > code for this is as follows:
      >
      > <?php
      > $from = me@myaddress.co m";
      > $subject = "Test";
      > $to = 'me2@myaddress. com;
      > $mailbody = 'mailbody';
      > mail($to,$subje ct,$message,$fr om);
      > ?>
      >
      > When I run the page/program I get the following error msg displayed:
      > "Warning: Failed to Connect in G:\home\server\ users\me.com\cg i-bin\send.php
      > on line 5"
      >
      > The mail is not delivered. I also tried with <> before and after the value
      > in the $form. And, of course, the addresses are really ones and both are
      > presents on the server. Does anyone know what the problem could be?[/color]

      Also, close your quotes for the "to" line:

      $to = 'me2@myaddress. com';

      not

      $to = 'me2@myaddress. com;

      Shawn
      --
      Shawn Wilson
      shawn@glassgian t.com

      Comment

      • scott john

        #4
        Re: problem when sending mail

        [color=blue][color=green]
        > > Have you defined an SMTP server in php.ini ?[/color][/color]

        Hello,

        I m developing a site which is located on a webhotell. Im testing my
        programs using ftp. If I run a page with phpinfo() then I can seee that
        there is a file named php.ini. Its on C:/. My site is on G, so I dont th8ink
        I can access that information or edit that file. What do you think?
        [color=blue]
        > Additionally, the $from variable must be a valid header, so change it to:
        > $from = "From: me@myaddress.co m";[/color]

        I changed this, without any result[color=blue]
        > You may also need to check which version of PHP you're using, since this[/color]
        header may not be honoured[color=blue]
        > in your version.
        >
        > http://php.net/manual/en/function.mail.php[/color]

        Checked this too. The version in use is the last one

        <phpbeginner>



        Comment

        Working...