windowsXP, Apache 2.2, MS Exchange SMTP, php 5, SMTP server requires no authorization.
I just loaded the swift library and executed the below test code.
I get email sent confirmation with no exception catches and no errors onscreen, but I don't receive the email.
Also, where is the swift.log saved at? I can't seem to find it on my system.
Can anyone help with this?
thanks
UPDATE:
ms exchanges shows message received with message ID of "12341234134143.swift@localhost"
our server requires qualified domains. Where is the "swift@localhost" coming from? Is this a library setting that I have to change?
<?php
require_once "\program files\php\swiftlib\lib\swift.php";
echo "required swift.php... ";
require_once "\program files\php\swiftlib\lib\swift\Connection\SMTP.php";
echo " required connection\smpt.php... ";
error_reporting(E_ALL); ini_set('display_errors', true);
try {
//Start Swift
$swift = new Swift(new Swift_Connection_SMTP("PCTEMAIL1"));
//Create the message
$message = new Swift_Message("My subject", "My body");
//Now check if Swift actually sends it
$swift->send($message, "webAdmin2@4pct.com", "webAdmin2@4pct.com");
echo "eMail Sent";
} catch (Swift_ConnectionException $e) {
echo "There was a problem communicating with SMTP: " . $e->getMessage();
} catch (Swift_Message_MimeException $e) {
echo "There was an unexpected problem building the email:" . $e->getMessage();
$swift->disconnect();
}
Says email sent, but don't receive it.
Moderators: Chris Corbyn, General Moderators
-
TheMatrixDuck
- Forum Newbie
- Posts: 4
- Joined: Fri Sep 12, 2008 12:49 pm
Re: Says email sent, but don't receive it.
Hi
I used to have that issue and its actually why i'm here. I thought i had resolved it but i have come to find out it was a partial fix, now i'm looking for something that will fix it permanently.
When my mails were sent but not delivered, i found out that when i edited the text in the body of the message, the mails got delivered. Its not exactly the length of the words but i dont know if it was just bouncing some particular words. The words are not reserved words to the best of my knowledge. e.g "An Idea has been submitted. Kindly log on to SPOTLITE.\r\n. Your response is required within 72 hours."
I changed the text when i deployed about 2 months ago. Now today, the mails are not being delivered again. Till i cut it down to "An Idea has been submitted."
Any further help. please?
I used to have that issue and its actually why i'm here. I thought i had resolved it but i have come to find out it was a partial fix, now i'm looking for something that will fix it permanently.
When my mails were sent but not delivered, i found out that when i edited the text in the body of the message, the mails got delivered. Its not exactly the length of the words but i dont know if it was just bouncing some particular words. The words are not reserved words to the best of my knowledge. e.g "An Idea has been submitted. Kindly log on to SPOTLITE.\r\n. Your response is required within 72 hours."
I changed the text when i deployed about 2 months ago. Now today, the mails are not being delivered again. Till i cut it down to "An Idea has been submitted."
Any further help. please?
-
TheMatrixDuck
- Forum Newbie
- Posts: 4
- Joined: Fri Sep 12, 2008 12:49 pm
Re: Says email sent, but don't receive it.
<!--------------------------------------------------------------------------
ContactUSMail.php
php Script to send email to WebAdmin where it will be routed
manually.
Created 9/16/08 by Dennis Dean
---------------------------------------------------------------------------->
<?php
require_once "\program files\php\swiftlib\lib\swift.php";
require_once "\program files\php\swiftlib\lib\swift\Connection\SMTP.php";
error_reporting(E_ALL); ini_set('display_errors', true);
// gather required information
$wTo = "WebContact@4pct.com";
$wFrom = $_POST["Name"];
$wSubject = "Website inquiry from ". $wFrom. ". Please contact us.";
$wCompany = $_POST["Company"];
$wTitle = $_POST["Title"];
$wWorkPhone = $_POST["WorkPhone"];
$wCellPhone = $_POST["CellPhone"];
$wEmail = $_POST["Email"];
$wComments = $_POST["Comments"];
// assign to body of mail message
$Mailbody = "A website user has requested contact.\n";
$Mailbody .= "Here is their contact information : \n\n";
$Mailbody .= "Name: " . $wFrom. "\n";
$Mailbody .= "Company: " . $wCompany. "\n" ;
$Mailbody .= "Title: " . $wTitle. "\n";
$Mailbody .= "Work: " . $wWorkPhone. "\n";
$Mailbody .= "Cell: " . $wCellPhone. "\n" ;
$Mailbody .= "email: " . $wEmail. "\n\n";
// retrieve the checkbox values...
if (isset($_POST["chkContractor"])) {
$Mailbody .= $wFrom. " is a contractor.\n";
}
if (isset($_POST["chkHomeowner"])) {
$Mailbody .= $wFrom. " is a homeowner.\n";
}
if (isset($_POST["chkDesigner"])) {
$Mailbody .= $wFrom. " is a designer.\n";
}
if (isset($_POST["chkBuilder"])) {
$Mailbody .= $wFrom. " is a builder.\n";
}
$Mailbody .= "\nComments: \n". $wComments."\n";
try {
//Start Swift
$swift = new Swift(new Swift_Connection_SMTP("PCTEMAIL1.pctinternal.net"));
//Create the message
$message = new Swift_Message($wSubject, $Mailbody);
//Now check if Swift actually sends it Send(Message, Recipient, From)
$swift->send($message, new Swift_Address("BiancaRuelig@4pct.com"), new Swift_Address("WebAdmin@4pct.com","WebAdmin-NO REPLY"));
} catch (Swift_ConnectionException $e) {
echo "There was a problem communicating with SMTP: " . $e->getMessage();
} catch (Swift_Message_MimeException $e) {
echo "There was an unexpected problem building the email:" . $e->getMessage();
$swift->disconnect();
}
// end php send email
?>
ContactUSMail.php
php Script to send email to WebAdmin where it will be routed
manually.
Created 9/16/08 by Dennis Dean
---------------------------------------------------------------------------->
<?php
require_once "\program files\php\swiftlib\lib\swift.php";
require_once "\program files\php\swiftlib\lib\swift\Connection\SMTP.php";
error_reporting(E_ALL); ini_set('display_errors', true);
// gather required information
$wTo = "WebContact@4pct.com";
$wFrom = $_POST["Name"];
$wSubject = "Website inquiry from ". $wFrom. ". Please contact us.";
$wCompany = $_POST["Company"];
$wTitle = $_POST["Title"];
$wWorkPhone = $_POST["WorkPhone"];
$wCellPhone = $_POST["CellPhone"];
$wEmail = $_POST["Email"];
$wComments = $_POST["Comments"];
// assign to body of mail message
$Mailbody = "A website user has requested contact.\n";
$Mailbody .= "Here is their contact information : \n\n";
$Mailbody .= "Name: " . $wFrom. "\n";
$Mailbody .= "Company: " . $wCompany. "\n" ;
$Mailbody .= "Title: " . $wTitle. "\n";
$Mailbody .= "Work: " . $wWorkPhone. "\n";
$Mailbody .= "Cell: " . $wCellPhone. "\n" ;
$Mailbody .= "email: " . $wEmail. "\n\n";
// retrieve the checkbox values...
if (isset($_POST["chkContractor"])) {
$Mailbody .= $wFrom. " is a contractor.\n";
}
if (isset($_POST["chkHomeowner"])) {
$Mailbody .= $wFrom. " is a homeowner.\n";
}
if (isset($_POST["chkDesigner"])) {
$Mailbody .= $wFrom. " is a designer.\n";
}
if (isset($_POST["chkBuilder"])) {
$Mailbody .= $wFrom. " is a builder.\n";
}
$Mailbody .= "\nComments: \n". $wComments."\n";
try {
//Start Swift
$swift = new Swift(new Swift_Connection_SMTP("PCTEMAIL1.pctinternal.net"));
//Create the message
$message = new Swift_Message($wSubject, $Mailbody);
//Now check if Swift actually sends it Send(Message, Recipient, From)
$swift->send($message, new Swift_Address("BiancaRuelig@4pct.com"), new Swift_Address("WebAdmin@4pct.com","WebAdmin-NO REPLY"));
} catch (Swift_ConnectionException $e) {
echo "There was a problem communicating with SMTP: " . $e->getMessage();
} catch (Swift_Message_MimeException $e) {
echo "There was an unexpected problem building the email:" . $e->getMessage();
$swift->disconnect();
}
// end php send email
?>
-
TheMatrixDuck
- Forum Newbie
- Posts: 4
- Joined: Fri Sep 12, 2008 12:49 pm
Re: Says email sent, but don't receive it. <RESOLVED>
This is resolved.