Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:40:10+00:00 2026-06-03T08:40:10+00:00

Here’s the failing code: require_once Mail.php; $host = mail.domain.com; $username = USER; $password =

  • 0

Here’s the failing code:

require_once "Mail.php";

$host           = "mail.domain.com";
$username       = "USER";
$password       = "PASS";

$mailto     = $name . ' <' . $email . '>';
$subject        = 'My Subject';
$from           = 'Client Name <info@clientdomain.com>';

$headers = array (
    'From' => $from,
    'To' => $mailto,
    'Subject' => $subject
);

$smtp = Mail::factory('smtp', array (
        'host' => $host,
        'port' => '25',
        'auth' => true,
        'username' => $username,
        'password' => $password
    )
);

$mail = $smtp->send($mailto, $headers, $msg);

if (PEAR::isError($mail)) {    
    echo '<br /><br />' . $mail->getMessage();
} else {
    echo '<br /><br />Worked';
}

I am passing the $email value to the script as follows:

$name = 'Joe Schmoe';
$email = 'webmaster@domain.com';
include ($_SERVER['DOCUMENT_ROOT'] . '/path/to/my/code/above.php');

When I run the script I get the following error:

Failed to add recipient: webmaster@domain.com@localhost
[SMTP: Invalid response code received from server
(code: 504, response: 5.5.2 :
    Recipient address rejected: need fully-qualified address)]

If I change the $mailto variable from:

$mailto     = $name . ' <' . $email . '>';

… to the following:

$mailto     = $name . ' <webmaster@domain.com>';

It works perfectly.

Can anyone tell me what I’m missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:40:12+00:00Added an answer on June 3, 2026 at 8:40 am

    I think @localhost is added to your $email variable in Mail.php

    Try changing the name of the $email variable in your script.

    Also you can use die($email); in your script to test the value of email in various stages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here is an example of what I need http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html I need interactive list to
Here is some simple code: DIR* pd = opendir(xxxx); struct dirent *cur; while (cur
Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@AlertTableView:
Here is my persistence.xml : <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd version=1.0>
Here is an example: I write html code inside of textarea, then I swap
Here's my Manifest: <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.mappp.mobile android:versionCode=1 android:versionName=1.0 > <supports-screens android:largeScreens=true
Here is a scenario: User installs .NET application that you have made. After some
Here is what is supposed to happen: The moment the user chooses an option
Here is my code...I have two dimensional matrices A,B. I want to develop the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.