SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me with this mail funcation in php

    Iam receiving the following error when I want to sent email using php script.

    Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in d:\apache\htdocs\ims\ticketstaff\type_in_ticket2.php on

    How can I solve this problem? My settings in php.ini and mail script are as follows;
    Note Iam using 4.3 php

    my php.ini file mail function declaration are as follows;

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = mobzam@web.org.zm

    and my php mail script is as follows;

    mail($adminemail, "TICKET SUBMITTED BY $LnameandFname", "$message","$headers","From:$zramail2\n");

  2. #2
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Brisbane, Australia
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure that "localhost" has an SMTP server running...

    Similar issue

  3. #3
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello TheAnarchist,
    Iam using remote machine as SMTP server, and it is running.
    so could it the reason??

  4. #4
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi zamzam,

    I don't think that it could be the reason.
    PHP Code:
    //make your heades like this
    $headers .= "From:$zramail2\n";

    // and your php mail() function
    if(!mail($adminemail"TICKET SUBMITTED BY $LnameandFname""$message","$headers"))
      echo 
    "Mail Sending Failed";
    else
      echo 
    "Mail Sent"
    Try this and let me know.
    Barbara

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Brisbane, Australia
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zamzam View Post
    Iam using remote machine as SMTP server, and it is running.
    Ah, there's the problem, I think.

    Quote Originally Posted by zamzam
    SMTP = localhost
    That line of your php.ini file is telling your PHP parser that the SMTP server is on your local machine, not on a remote machine.

    You can do one of two things:
    1. Put the script you're working on and the SMTP server on the same machine; or
    2. Change your php.ini file - instead of "localhost", put the IP address of the remote machine where the SMTP server is running.

  6. #6
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Iam still receiving the following error message

    Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in d:\apache\htdocs\ims\ticketstaff\type_in_ticket2.php on line 181

  7. #7
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    could you please put your code for $headers here?
    Barbara

  8. #8
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure this location d:\apache\htdocs\ims\ticketstaff\type_in_ticket2.php is in the remote server where the SMTP is running? I think you are running your file in your system and trying to send emails. What you mean by that you have using remote SMTP server and it is running?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  9. #9
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have changed and still receiving the same problem

    [mail function]
    ; For Win32 only.
    SMTP = maildogo
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = mobzam@web.org.zm

    and my php mail script is as follows;

    mail($adminemail, "TICKET SUBMITTED BY $LnameandFname", "$message","$headers","From:$zramail2\n");


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
  •