Advertisement

03.03.2005 at 02:42AM PST, ID: 21336051
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

PHP Mailer Error: Message was not sent Mailer Error: Language string failed to load: recipients_failed

Tags: failed, string, language, mailer, recipients_failed
Hi,

We are running PHP through IIS 6 on a Windows 2003 server, we have recently closed anonymous access to close an open relay, we've then found out that you need to authenticate your php emails in order for them to send.

now i've setup phpmailer as follows:

<CODE>

require("class.phpmailer.php");

$mail = new PHPMailer();
$message = $this->body;

$mail->IsSMTP();        
$mail->Host     = "<REMOVED>";
$mail->SMTPAuth = true;    
$mail->Username = "<REMOVED>";
$mail->Password = "<REMOVED>";

$mail->From     = "website@website.com";
$mail->FromName = "";
$mail->AddAddress("Address of Client","");
$mail->AddAddress("");
$mail->AddCC("");  
$mail->AddReplyTo("","");

$mail->WordWrap = 10000;                              
$mail->AddAttachment("");      
$mail->AddAttachment("");
$mail->IsHTML(true);                              

$mail->Subject  =  "Website Reply";
$mail->Body     =  "$message";
$mail->AltBody  =  "";

if(!$mail->Send())
{
   echo "Message was not sent <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "</br></br></br></br><div align=\"center\"><strong>Thankyou for submitting an Enquiry to <REMOVED></br>Your enquiry has been passed on to one of our consultants </br> Who will contact you shortly. </br></br> <REMOVED></strong></div><div align=\"center\"></br><form name=\"form1\" method=\"post\" action=\"thanks.html\"><input type=\"submit\" name=\"Submit\" value=\"Back to Riversdale Mortgage Services\"></form></div><SCRIPT LANGUAGE=\"JavaScript\">window.location=\"thanks.html\"</script>";
            
}

</CODE>

$message variable in the body line is equal to a hidden field located on the form page which is then posted into the email.

i am pulling in all the data from a div class located around the whole form,

<div id="emaildata">
FORM CONTENT
</div>

I seemed to have stopped the authenticated error message that was being displayed but,

Now when i try to submit the form i get the following error:

Message was not sent.
Mailer Error: Language string failed to load: recipients_failed,

but i've copied the class.phpmailer.php & class.smtp.php & the lang_en.php to the c:\php\include folder.

i've somehow been able to get it working but every 2 out of 5 emails or so will come out blank? the rest seem to work fine.

i'm pretty sure its not the code, but rather something i havn't setup up in IIS or PHP ?

Some help would be greatly appreciated.

Ian
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: webpolsol
Solution Provided By: RQuadling
Participating Experts: 2
Solution Grade: A
Views: 417
Translate:
Loading Advertisement...
03.03.2005 at 03:17AM PST, ID: 13448138

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 03:19AM PST, ID: 13448151

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 03:44AM PST, ID: 13448279

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 03:49AM PST, ID: 13448309

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 03:52AM PST, ID: 13448321

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 04:12AM PST, ID: 13448417

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 04:18AM PST, ID: 13448452

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 04:28AM PST, ID: 13448514

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 04:39AM PST, ID: 13448578

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 05:10AM PST, ID: 13448784

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 05:27AM PST, ID: 13448904

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 05:42AM PST, ID: 13449023

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 05:54AM PST, ID: 13449174

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 06:15AM PST, ID: 13449431

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 06:22AM PST, ID: 13449523

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 06:27AM PST, ID: 13449555

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.03.2005 at 07:03AM PST, ID: 13449972

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.09.2005 at 07:35PM PST, ID: 13502851

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.03.2005 at 03:17AM PST, ID: 13448138

Rank: Guru

Hi webpolsol,

Why not send the email directly to the correct server rather than relaying it through your own servers?

I use the following REALLY simple email script.

        preg_match("'\.*@(.*)'sim", $k, $aEmailMatches);
        $sNSLookup = shell_exec("nslookup -q=mx {$aEmailMatches[1]} 10.0.0.7 2>nul"); // 10.0.0.7 is my default gateway.
        preg_match_all("'^.*MX preference = (\d{1,10}), mail exchanger = (.*)$'simU", $sNSLookup, $aMXMatches);
        asort($aMXMatches[1]);
        reset($aMXMatches[1]);
        ini_set('SMTP', $aMXMatches[2][key($aMXMatches[1])]);
        mail($k, $sSubject, $sMessage, $sHeaders);



Regards,

Richard Quadling.
Accepted Solution
 
03.03.2005 at 03:19AM PST, ID: 13448151

Rank: Guru

webpolsol,

Basically, I get the Mail Exchange record for the person I want to send the email to. I then set PHP to use their SMTP server to send email. Works every time. And saves the relaying nonsense. This is all that a relay would do. No need to worry about authenticating to your server to send email either!

Regards,

Richard.
 
03.03.2005 at 03:44AM PST, ID: 13448279
How do i point php mailer to their smtp server?

is it just a case of:

<CODE>

require("class.phpmailer.php");

$mail = new PHPMailer();
$message = $this->body;

$mail->IsSMTP();        
$mail->Host     = "CLIENTS MAIL SERVER IP";
$mail->SMTPAuth = true;    
$mail->Username = "USERNAME";
$mail->Password = "PASSWORD";

$mail->From     = "website@website.com";
$mail->FromName = "";
$mail->AddAddress("Address of Client","");
$mail->AddAddress("");
$mail->AddCC("");  
$mail->AddReplyTo("","");

$mail->WordWrap = 10000;                              
$mail->AddAttachment("");      
$mail->AddAttachment("");
$mail->IsHTML(true);                              

$mail->Subject  =  "Website Reply";
$mail->Body     =  "$message";
$mail->AltBody  =  "";

if(!$mail->Send())
{
   echo "Message was not sent <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "hurrah";

</CODE>

can you post an example using phpmailer ?

and one last thing, why would it send out emails some being blank and others being fine ?.

Thanks,

Ian
 
03.03.2005 at 03:49AM PST, ID: 13448309
i should also note that this email does not go to just one person,

it picks up an address from a MySQL database

and inserts it into the address line in php mailer.

the db holds all the address but only picks the single next email address in line to send to everytime the form is posted.

so if i have 3 email address added to the database,

tom@tom.com
jimmy@jimmy.com
fred@fred.com

first time form is posted tom will get an email, second time jimmy and third fred.

Thanks again,

Ian
 
03.03.2005 at 03:52AM PST, ID: 13448321

Rank: Guru

phpmailer requires a locally configures SMTP server.

I just wouldn't bother. As you have seen all the relay is doing is STOPPING you from sending email.

Can phpmailer return the mail message?

If so, then do all you are already doing with it, except the $mail->Send() bit.

THen use my code to find the email server for the person you are sending the email to and send it direct.

Richard.
 
03.03.2005 at 04:12AM PST, ID: 13448417
can you break your script down a bit then please, as i'm having trouble following it.

i need to be able to send HTML emails, whilst using a variable called $message as the body and also i need to send it to an address located in a varibale also called $address.

then do i just paste that into my script and hey presto?

Thanks,

Ian
 
03.03.2005 at 04:18AM PST, ID: 13448452

Rank: Guru

// Extract the host from the email address
        preg_match("'\.*@(.*)'sim", $sEmailAddress, $aEmailMatches);

// Use NSLOOKUP to get the Mail Exchange record for the email address' domain
        $sNSLookup = shell_exec("nslookup -q=mx {$aEmailMatches[1]} 10.0.0.7 2>nul"); // 10.0.0.7 is my default gateway.

// Look for MX preferences.
        preg_match_all("'^.*MX preference = (\d{1,10}), mail exchanger = (.*)$'simU", $sNSLookup, $aMXMatches);

// Sort so that the lowest preference is at the top. Not sure if the low preference is the one to use.
        asort($aMXMatches[1]);

// Set the array to the beginning.
        reset($aMXMatches[1]);

// Set the SMTP server which PHP will use to the server supplied in the preference.
        ini_set('SMTP', $aMXMatches[2][key($aMXMatches[1])]);

// Send the email.
        mail($sEmailAddress, $sSubject, $sMessage, $sHeaders);
 
03.03.2005 at 04:28AM PST, ID: 13448514
Thats excellent, just one more thing.

in that where do i insert my variables?

$address
$message

and then all i do is change 10.0.0.7 to point to the clients mail server?

and will this work if they are using different name extentions.

say tom@tom.com and also tom@website.com ?

Thankyou,

Ian
 
03.03.2005 at 04:39AM PST, ID: 13448578

Rank: Guru

Ok.

10.0.0.7 is MY gateway address on my network.

I'm on windows. CMD prompt.

ipconfig /all

Look for default gateway.

This is the 10.0.0.7. This is how network traffic is routed from your pc over the LAN to the outside world. (ish!).

I've no idea what it will be for you, but it would probably be 10.x.x.x or 192.168.x.x. There are other internal IP address ranges.

If you are on a single pc with a dial up connection, you COULD have anything in here.

This is NOT the ip address of the SMTP server you are sending the email to.


If you are on windows.

Try this at a CMD prompt.

NSLOOKUP -q=MX experts-exchange.com

The important line is ...

experts-exchange.com    MX preference = 1, mail exchanger = mail.experts-exchange.com

So, to send email to anyone whose email address is something@experts-exchange.com, you need to be talking to the mail.experts-exchange.com SMTP server.

Try btinternet.com.

This has 2 servers.

btinternet.com  MX preference = 20, mail exchanger = mx1.bt.mail.yahoo.com
btinternet.com  MX preference = 30, mail exchanger = mx2.bt.mail.yahoo.com

So, email send to bob@btinternet.com is going to be handled by mx1.bt.mail.yahoo.com

See?

I am using the normal mail() function in PHP, so that is ...

mail(email, subject, message, headers).

All of which are part of the phpmailer class. Just need to know how to extract them. I don't use any email classes as my method works for me!

With this method, you can only send email one at a time, unless you aggregate the servers first. Something I've not bothered to do.


Richard.
 
03.03.2005 at 05:10AM PST, ID: 13448784
Richard,

thankyou so much, but all i need is a FULL example of code that;

a) picks up my email address variable containing the email address and message body.

$address = "tom@website.com";
$message = "content";

b) sends it out to that address in HTML format.

please use these variables.

so that when its set,

all i have to do is change the gateway add.

Many Thanks,

Ian
 
03.03.2005 at 05:27AM PST, ID: 13448904

Rank: Guru

Not the gateway add. This is fixed for your site, pc, whatever is running the script. The server will need to be able to nslookup (as the ones built into PHP don't work on Windows!).

Ok. Just got hold of phpmailer.

Try this.

Do everything with the phpmailer class like you already have done.

You can only use 1 email address at a time (unless you aggregate against the smtp server for each address).

Instead of the $mail->send()...

        preg_match("'\.*@(.*)'sim", $address, $aEmailMatches);
        $sNSLookup = shell_exec("nslookup -q=mx {$aEmailMatches[1]} 10.0.0.7 2>nul"); // 10.0.0.7 is my default gateway.
        preg_match_all("'^.*MX preference = (\d{1,10}), mail exchanger = (.*)$'simU", $sNSLookup, $aMXMatches);
        asort($aMXMatches[1]);
        reset($aMXMatches[1]);
        ini_set('SMTP', $aMXMatches[2][key($aMXMatches[1])]);
        mail($address, $mail->EncodeHeader($mail->Subject), $mail->CreateBody(), $mail->CreateHeader());

Richard.
 
03.03.2005 at 05:42AM PST, ID: 13449023
Did not work and got alot of errors. . .

<CODE>

Notice: Undefined variable: address in D:\<REMOVED>emailus.php on line 34

Notice: Undefined offset: 1 in D:\<REMOVED>emailus.php on line 35

Warning: shell_exec(): Unable to execute 'nslookup -q=mx <REMOVED> 2>nul' in D:\<REMOVED>emailus.php on line 35

Notice: Undefined index: in D:\<REMOVED>emailus.php on line 39

Notice: Undefined variable: address in D:\<REMOVED>emailus.php on line 40

Warning: mail(): Failed to connect to mailserver at "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\<REMOVED>emailus.php on line 40
Message has been sent

</CODE>

and heres what i done.

<CODE>

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "<REMOVED>";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "<REMOVED>";  // SMTP username
$mail->Password = "<REMOVED>"; // SMTP password

$mail->From = "from@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("<REMOVED>", "<REMOVED>");
$mail->AddAddress("");                  // name is optional
$mail->AddReplyTo("", "");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->AddAttachment("");         // add attachments
$mail->AddAttachment("", "");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Website Reply";
$mail->Body    = "Name Of Contact: $name \n \n Telephone Number: $tel \n \n E-mail Address Of Contact: \n \n $email \n \n Comments Made: \n \n $comments \n \n";
$mail->AltBody = "";

preg_match("'\.*@(.*)'sim", $address, $aEmailMatches);
        $sNSLookup = shell_exec("nslookup -q=mx {$aEmailMatches[1]} <REMOVED> 2>nul"); // 10.0.0.7 is my default gateway.
        preg_match_all("'^.*MX preference = (\d{1,10}), mail exchanger = (.*)$'simU", $sNSLookup, $aMXMatches);
        asort($aMXMatches[1]);
        reset($aMXMatches[1]);
        ini_set('SMTP', $aMXMatches[2][key($aMXMatches[1])]);
        mail($address, $mail->EncodeHeader($mail->Subject), $mail->CreateBody(), $mail->CreateHeader());

echo "Message has been sent";

</CODE>

What i'm a doing wrong?
 
03.03.2005 at 05:54AM PST, ID: 13449174

Rank: Guru

Notice: Undefined variable: address in D:\<REMOVED>emailus.php on line 34

You said you had a variable called $address. I'm just using it! If it is NOT called $address, what IS it called? Put it in line 34.


Notice: Undefined offset: 1 in D:\<REMOVED>emailus.php on line 35

No address = no preg_match_all!


Warning: shell_exec(): Unable to execute 'nslookup -q=mx <REMOVED> 2>nul' in D:\<REMOVED>emailus.php on line 35

Ah. Your machine does not have nslookup on it. What OS are you running?


Notice: Undefined index: in D:\<REMOVED>emailus.php on line 39

No address = no preg_match_all!



Notice: Undefined variable: address in D:\<REMOVED>emailus.php on line 40

No address = no preg_match_all!



Warning: mail(): Failed to connect to mailserver at "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\<REMOVED>emailus.php on line 40

No NSLOOKUP, no smtp server name!

Message has been sent
 
03.03.2005 at 06:15AM PST, ID: 13449431
We are running IIS 6 on a Windows 2003 Server.
this server is the one in which we have closed the relay and is also our webserver for hosting sites.

sorry was a typo on the $address i have sorted that problem now and have reduced the errors to this.

Warning: shell_exec(): Unable to execute 'nslookup -q=mx <REMOVED>.co.uk <REMOVED> 2>nul' in D:\<REMOVED>emailus.php on line 36

Notice: Undefined index: in D:\<REMOVED>emailus.php on line 40

Warning: mail(): Failed to connect to mailserver at "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\<REMOVED>emailus.php on line 41
Message has been sent

about the mailserver name i've checked our php.ini and it has a name in it but it doesnt seem to be picking it up. ?
 
03.03.2005 at 06:22AM PST, ID: 13449523

Rank: Guru

Are you using safe mode on the server?

<?php phpinfo(); ?>

and look for safe_mode and disabled_functions. If you are using Safe Mode, then you cannot use shell_exec.

Richard.
 
03.03.2005 at 06:27AM PST, ID: 13449555

Rank: Guru

Ok. About the mail server stuff.

Your webserver is A.
Your email server is B (A may equal B).
The email server for the recipient is C (I will assume that C does not equal B).

My script uses A to get email directly to C. It does not use B. If your php.ini file has B in it, so what, don't care, not using it.

The php mail() function looks at the value of SMTP and SMTP_PORT (Oh. I assume the port is set to 25 for SMTP?) If not ...

        ini_set('SMTP_PORT', 25);
        ini_set('SMTP', $aMXMatches[2][key($aMXMatches[1])]);


Without the NSLOOKUP (this is the program that takes the domain of the email recipient and works out the names of their available email servers, the C part in my equation) you cannot use my script.

It may be that the IIS user does not have permission to run NSLOOKUP. Deal with that as you may. I don't use IIS. I use Sambar. Much easier!

Richard.
 
03.03.2005 at 07:03AM PST, ID: 13449972
got it working!

Its now sending all mails and also modified it to send out to another person through;

$mail->AddCC("$address");

merci bocue.

Ian
 
03.09.2005 at 07:35PM PST, ID: 13502851
PLEASE HELP!!  This is the most frustrating thing I've encountered in a long time.  I'm using PHP and phpmailer.  My application has worked fine for a long time.  Then, the admins upgraded to PHP v5.0.1 and everything quit working.  I've examined all the PHP config variables and reset everything that looked necessary, but my mail forms still don't work.  I also believe the admins implemented SMTP authentication which may be impacting me.

==========================
My code looks like this:

  $mail = new PHPMailer();
  $mail->Encoding = "8bit";
  $mail->CharSet = "iso-8859-1";
  $mail->From = "$EMAIL1";
  $mail->FromName = "$MYNAME";
  $mail->AddAddress("$submittal_email_addresses", "name");
  $mail->Subject = "Contact Message";
  $mail->Body = "Name: $MYNAME\nPhone: $CONTACT_PHONE\nEmail: $EMAIL1\nComments:\n$theCOMMENTS\n\n";

if(!$mail->Send())
{
   echo "There was an error sending the message";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message was sent successfully";

}
==========================
My error is this:
   Mailer Error: Language string failed to load: instantiate

==========================
I've tried many, many suggested changes I've found on the web including the following:

With:      $mail->IsSendmail();
Get:      Mailer Error: Language string failed to load: execute/usr/sbin/sendmail

With:       Adding  $mail->SetLanguage("en", "phpmailer/language/");
Get:      Mailer Error: Could not instantiate mail function.

With:      $mail->port = 25;
$mail->helo = '';
$mail->auth = TRUE;
$mail->user = 'me@domain.org';
$mail->pass = 'xxxxxxxxxxxxxx';
Get:      Mailer Error: Language string failed to load: instantiate

With:      {above}, plus
               $mail->IsSMTP();
Get:      Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 (A non-blocking socket operation could not be completed immediately. ) in D:\path\phpmailer\class.smtp.php on line 105
There was an error sending the messageMailer Error: Language string failed to load: connect_host

With:      {above}, plus
$mail->Host = "domain.org";
$mail->SMTPAuth = TRUE;
$mail->username = 'me@domain.org';
$mail->password = 'xxxxxxxxx';
Get:      Mailer Error: Language string failed to load: from_failed me@domain.org

With:      {above}, plus
$mail->From = "me@domain.org";
Get:      Mailer Error: Language string failed to load: from_failed me@domain.org

==============================
Please HELP!  Thanks!
 
 
20080236-EE-VQP-29