PHP Classes

How to send only to Bcc:

Recommend this page to a friend!

      SMTP E-mail sending class  >  All threads  >  How to send only to Bcc:  >  (Un) Subscribe thread alerts  
Subject:How to send only to Bcc:
Summary:Sending only to Bcc:
Messages:6
Author:Jacek
Date:2008-10-06 23:30:52
Update:2009-12-15 08:33:03
 

  1. How to send only to Bcc:   Reply   Report abuse  
Picture of Jacek Jacek - 2008-10-06 23:30:52
I've got a little problem, when i try to send mail only with Bcc: recipients, mail sends ok, but returns with failure notice.

Here's my code:

$smtp->SendMessage(
$mail_from,
array(),
array(
"From: ".$mail_from,
"Bcc: ".$mail_rec,
"Subject: ".$mail_calosc['temat'],
"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z"),
"MIME-Version: 1.0",
"Content-Transfer-Encoding: 8bit",
"Content-Type: text/html; charset=\"utf-8\""
),
$body);

Where $mail_rec is a string with email addresses separated by ,

And failure notice is:

<@mail.xx.xx>:
Sorry, no mailbox here by that name. (#5.1.1)

where mail.xx.xx is part of my mailbox hostname.

When instead of array(), I use any email addresses, the mail is delivered only to this addresses and not to ones from Bcc:

When I use the same addresses in Bcc: and To: (instead of empty array),
the mail goes ok, but the header field Bcc: is visible to the recipients.


maybe it's a problem with mailbox configuration?

  2. Re: How to send only to Bcc:   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-10-07 01:45:26 - In reply to message 1 from Jacek
When you send messages via SMTP, the headers are not processed by the SMTP server. You should not add Bcc: headers to the message. You just need to add the hidden recipients to the recipients list.

Anyway, to properly compose and send a message to be sent via SMTP, you should use the MIME message compose and sending class in conjunction with the SMTP class. Take a look at the test_smtp_message.php example script:

phpclasses.org/mimemessage

  3. Re: How to send only to Bcc:   Reply   Report abuse  
Picture of Wolfgang Wolfgang - 2009-12-11 09:14:28 - In reply to message 2 from Manuel Lemos
i have no message in the test_smtp_message.php example

  4. Re: How to send only to Bcc:   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-12-11 16:03:15 - In reply to message 3 from Wolfgang
That may happen for a varied number of reasons unrelated with the class.

First you need to confirm that the SMTP server that you are using actually accepts the message for delivery.

Try setting the debug variable to 1 and show what is the output of that script.

  5. Re: How to send only to Bcc:   Reply   Report abuse  
Picture of Wolfgang Wolfgang - 2009-12-15 08:28:55 - In reply to message 4 from Manuel Lemos
everything seems to be ok message is send headers correct no body.

Resolving POP3 authentication host "mail.xxx.at"...
Connecting to host address "xxx" port 110...
S +OK POP3 web-wien.xxx.at v2003.83 server ready
C USER xxx
S +OK User name accepted, password please
C PASS xxx
S +OK Mailbox open, 3 messages
Resolving SMTP server domain "mail.xxx.at"...
Connecting to host address "" port 25...
Connected to SMTP server "xxx".
S 220 mx-server ESMTP
C EHLO localhost
S 250-web-wien.xxx.at Hello web-wien.xxx.at [], pleased to meet you
S 250-ENHANCEDSTATUSCODES
S 250-PIPELINING
S 250-8BITMIME
S 250-SIZE
S 250-DSN
S 250-ETRN
S 250-AUTH PLAIN LOGIN
S 250-DELIVERBY
S 250 HELP
C MAIL FROM:<xxx>
C RCPT TO:<xxx>
C DATA
S 250 2.1.0 <>... Sender ok
S 250 2.1.5 <>... Recipient ok
S 354 Enter mail, end with "." on a line by itself
C To: Manuel Lemos <info@xxx.at>
Subject: Testing Manuel Lemos' Email SMTP sending PHP class
From: <info@xxx.at>
Reply-To: <info@xxx.at>
Return-Path: info@xxx.at
Errors-To: <info@xxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Date: Tue, 15 Dec 2009 09:20:00 CET
Message-ID: <20091215092000.6235.info@xxx.at>


C
.
S 250 2.0.0 nBF8K0Up022538 Message accepted for delivery
C QUIT
S 221 2.0.0 web-wien.xxx.at closing connection
Disconnected.
Done.

  6. Re: How to send only to Bcc:   Reply   Report abuse  
Picture of Wolfgang Wolfgang - 2009-12-15 08:33:03 - In reply to message 5 from Wolfgang
o its a problem with the message error 354 i will check it out ;-)