www.webdeveloper.com
Results 1 to 5 of 5

Thread: mail() - "sendmail_from" not set in php.ini

  1. #1
    Join Date
    Jun 2008
    Posts
    207

    mail() - "sendmail_from" not set in php.ini

    I am trying to use the mail() function. However get this error on execution:

    Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\domains\n\mywebsite.co.uk\user\htdocs\test.php on line 1

    I am currently using fasthosts as my web hosting service. Because of this i can't access the php.ini file to make the necessary changes.

    Is there any other way of doing this?

    Thanks in advance.

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    as the error message says, just add a From: header and pass it to the mail function:

    PHP Code:
    mail('foo@bar.com''Subject''Hello foo!'"From:bar@foo.com\r\n"); 

  3. #3
    Join Date
    Jun 2008
    Posts
    207
    Hi, Thanks for your response. But when i run it with From header i get this error:

    Warning: mail() [function.mail]: SMTP server response: 554 <tom@email.co.uk>: Recipient address rejected: Relay access denied in E:\domains\n\mywebsite.co.uk\user\htdocs\test.php on line 3

    Any ideas what's causing this?

  4. #4
    Join Date
    Nov 2008
    Posts
    2,477
    Most likely your mail server is not set up correctly for your current needs. It seems like the mail script is not authenticating properly. You'll either need to configure your smtp server or else use a different one (both of which I believe are out of the scope of PHP's mail function but don't quote me on that as I use the PEAR Mail class instead - which incidentally would probably help you out if you dont want to muck about with your local mail server).

  5. #5
    Join Date
    Jul 2012
    Posts
    1

    hi

    how to set the SMTP server in php...
    i get this warnin when i try to send mail

    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\pro_php\register.php on line 60

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles