PHP Classes

Can Not Send Mail

Recommend this page to a friend!

      MIME E-mail message sending  >  MIME E-mail message sending package blog  >  How Can PHP Send Emai...  >  All threads  >  Can Not Send Mail  >  (Un) Subscribe thread alerts  
Subject:Can Not Send Mail
Summary:Bad $from_address feild? Works with some, not with others...
Messages:14
Author:Robert M
Date:2007-07-06 19:22:22
Update:2007-09-27 01:26:37
 
  1 - 10   11 - 14  

  1. Can Not Send Mail   Reply   Report abuse  
Picture of Robert M Robert M - 2007-07-06 19:22:23
Hello,

I am attempting to send mail out to my users when they register for an account, need a new password, etc. but I keep getting the "Error: it was not possible to send e-mail message". This appears to be my problem:

I take the test_email_message.php file, and upload it to my server along with the required include. I edit only the $to_address=""; and change it to my email address. I then try to send the mail. It works, I get the mail.

Then I change the $from_address= to:
$from_address="admin@afrikacentral.com";

It then gives me the error, and I don't get the mail. I've run many tests and it appears that if the $from_address= is set to "admin@afrikacentral.com" it will not work. Other variations of it will work fine, such as "admin@afrika.com" or "admin@afrikacentra.com" or "admin@afrikacentralll.com" or even "admin@afrikacentralsdfasadfsdf.com".

It just seems to have a problem with that one trailing l all the time. If anyone can offer a solution that would be great. Thanks!

P.S.. I attempted to post this issue at the Google group- twice. But no matter what it would say "your post will appear momentarily" and then it would never show... unless I am completely blind and it is there.

  2. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-06 20:57:14 - In reply to message 1 from Robert M
It seems that the PHP mail() function, used by the base class, is not working on your environment for some reason. Maybe you are not allowed to send messages to external servers due to some misconfiguration.

Can you send messages via an SMTP server? If so, you can use the smtp_message_class that is the sub-class of the email_message_class . It uses an SMTP server to relay messages instead of the mail() function.

The usage is almost the same, apart from some variable settings to specify the SMTP server details. Take a look at the test_smtp_message.php script to see an example.

  3. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Robert M Robert M - 2007-07-06 21:39:35 - In reply to message 2 from Manuel Lemos
Thanks for the response.

I don't think that is the case (with the external servers), as I can send emails to my hotmail address, or my ISP email address from my webhost.

The SMTP server is the same problem, I tried it doing the same thing- copying the test file onto my server and only changing the to_address then sending. It worked. So then I changed the from_address (or the address that I want the emails to reply to) and that is when it stopped working.

It only seems to be a problem when I use admin@afrikacentral.com as the FROM address. Everything else will work; admin@afrikacentrallll.com, admin@afrikacente.com, @afrika.com, @afrikacenteradfgsdfg.com will all work.

(And by work, I mean I will get the email in my external mail server and the from_address (the reply address) will be one of the above.)

P.S. I noticed that my post from last night appeared on Google- looks like they are slow with there postings.

  4. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-06 23:00:01 - In reply to message 3 from Robert M
Yes, but if you can try sending using the SMTP sub-class, please enable the debug output and paste the SMTP dialog here so I can see what the server is complaining about.

  5. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Robert M Robert M - 2007-07-06 23:28:12 - In reply to message 4 from Manuel Lemos
Good idea. *runs off and does the test* Okay, here we go:
___________________________________________
Resolving SMTP server domain "localhost"...
Connecting to host address "127.0.0.1" port 25...
Connected to SMTP server "localhost".
S 220-*******.bluehost.com ESMTP Exim 4.66 #1 Fri, 06 Jul 2007 17:24:32 -0600
S 220-We do not authorize the use of this system to transport unsolicited,
S 220 and/or bulk e-mail.
C EHLO localhost
S 250-*******.bluehost.com Hello localhost [127.0.0.1]
S 250-SIZE 52428800
S 250-PIPELINING
S 250-AUTH PLAIN LOGIN
S 250-STARTTLS
S 250 HELP
C MAIL FROM:<admin@afrikacentral.com>
C RCPT TO:<USER@ISP> /* I've changed this line, it is pointing to a valid email addr.. */
C DATA
S 250 OK
S 550-Verification failed for <admin@afrikacentral.com>
Disconnected.
Error: 550-Verification failed for
____________________________________________

Verification failed? Hrm...

  6. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-07-07 06:30:02 - In reply to message 5 from Robert M
It seems that SMTP server requires authentication. You need to specify an user name and password to send messages to other domains via SMTP.

  7. Re: Can Not Send Mail   Reply   Report abuse  
Picture of ron ron - 2007-09-23 03:50:53 - In reply to message 6 from Manuel Lemos
I have the same problem with the MIME message class. Probably because of my ISP. Is there any way to send HTML messages via the SMTP message class?

  8. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-23 06:54:17 - In reply to message 7 from ron
Sure, just take a look at the HTML sending example scripts like test_simple_html_mail_message.php or test_html_mail_message.php . Those use the base class email_message_class.

You can send messages via SMTP using the smtp_message_class instead email_message_class. For that you need to include also the classes smtp_message.php, smtp.php and sasl.php if you need to authenticate.

You also need to set some class variables to configure the SMTP server host and authentication credentials. Take a look at the test_smtp_message.php for examples.

  9. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Waldir Liebmann Waldir Liebmann - 2007-09-25 12:02:33 - In reply to message 8 from Manuel Lemos
Hi there, I am having a similar problem: my mails sent by sendmail reaches its destination, but the from address and name shows: SYNTAX-ERROR, or "(unknown)". Any suggestions?

The header of the message received:

Return-Path: <n17773@sh.insite.com.br>
Delivered-To: waldir@gruposecrel.com.br
Received: (qmail 13880 invoked by uid 89); 23 Sep 2007 23:46:55 -0000
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb-spambr_20030926a (2006-10-05)
on sec7.secrel.com.br
X-Spam-Level: ***
X-Spam-Status: No, score=3.9 required=5.0 tests=FROM_NO_LOWER,
HTML_IMAGE_ONLY_16,HTML_IMAGE_RATIO_02,HTML_MESSAGE,
HTML_SHORT_LINK_IMG_2,INVALID_MSGID,MPART_ALT_DIFF,MSGID_NO_HOST
autolearn=disabled version=3.1.7-deb-spambr_20030926a
Received: from unknown (HELO sec25.secrel.com.br) (192.168.3.249)
by sec7.secrel.com.br with SMTP; 23 Sep 2007 23:46:55 -0000
Received: (qmail 7006 invoked by uid 98); 23 Sep 2007 23:46:57 -0000
Received: from localhost (HELO sec25) (127.0.0.1)
by sec25.secrel.com.br with SMTP; 23 Sep 2007 23:46:57 -0000
Received: (qmail 6999 invoked by uid 98); 23 Sep 2007 23:46:57 -0000
Received: from sh.insite.com.br (66.135.41.202)
by sec25.secrel.com.br with SMTP; 23 Sep 2007 23:46:57 -0000
Received-SPF: none (sec25.secrel.com.br: domain at sh.insite.com.br does not designate permitted sender hosts)
Received: from n17773 by sh.insite.com.br with local (Exim 4.68)
(envelope-from <n17773@sh.insite.com.br>)
id 1IZbAB-0006RB-Ew
for waldir@gruposecrel.com.br; Sun, 23 Sep 2007 20:46:59 -0300
To: Waldir <waldir@gruposecrel.com.br>
Subject: Eita la!
From: <>
Reply-To: <>
Errors-To: <>
X-Mailer: http://www.phpclasses.org/mimemessage $Revision: 1.75 $ (sendmail $Revision: 1.15 $)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="34a12f977237ee0352793fe30e53f8c0"
Message-ID: <20070923204659.4533.@>
Date: Sun, 23 Sep 2007 20:46:59 -0300
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - sh.insite.com.br
X-AntiAbuse: Original Domain - gruposecrel.com.br
X-AntiAbuse: Originator/Caller UID/GID - [956 32002] / [47 12]
X-AntiAbuse: Sender Address Domain - sh.insite.com.br
X-Source: /usr/bin/php
X-Source-Args: /usr/bin/php enviarmensagemmassa.php
X-Source-Dir: neurotraumabrasil.com.br:/public_html/adminphp
X-Antivirus: avast! (VPS 000775-6, 22/09/2007), Inbound message
X-Antivirus-Status: Clean

  10. Re: Can Not Send Mail   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-25 16:46:02 - In reply to message 9 from Waldir Liebmann
That is because you have specified an empty string as e-mail address in the From: header.

 
  1 - 10   11 - 14