PHP SMTP : each Bcc <email> into their own email Message

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 25. November 2021 08:04

Hello!
We can put any generic value into the each message but how can we put their own BCC Email address
into each of their own Message.

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "Bcc: developers@gmail.com" . "\r\n";

$message = "
<html>
<body>
Hello $_GET['Bcc'] ;
Its a test message.

</body>
</html>
";

mail($to,$subject,$message,$headers);

thanks
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Altrea » 25. November 2021 08:19

Hi,

Like every other variable content you want to use multiple times, put it in a variable first.
Thats PHP / programming 101 knowledge.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11300
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 25. November 2021 08:26

Altrea wrote:Hi,

Like every other variable content you want to use multiple times, put it in a variable first.
Thats PHP / programming 101 knowledge.


if you read the message i asked how to put BCC into each Message.
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Nobbie » 25. November 2021 10:28

The question is, how to determine "the own mail address". As you do not specify any From : sender in your mail() function call, the system uses the configuration of the sendmail configuration or of the SMTP server which is specified in php.ini

But this is NOT evaluated by PHP, the physical sending of the mail is done by the corresponding mail server and an address of the sender is applied by that mail server. You cannot easily evaluate the mail configuration in your PHP script.You can only specify your own From: clause in the 5th parameter of mail(), which overrides the default of the mail server and finally apply the same value to Bcc:
Nobbie
 
Posts: 12256
Joined: 09. March 2008 13:04

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Altrea » 25. November 2021 11:32

I read the message, but probably i don't understand it.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11300
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 27. November 2021 15:28

Nobbie wrote:The question is, how to determine "the own mail address". As you do not specify any From : sender in your mail() function call, the system uses the configuration of the sendmail configuration or of the SMTP server which is specified in php.ini

But this is NOT evaluated by PHP, the physical sending of the mail is done by the corresponding mail server and an address of the sender is applied by that mail server. You cannot easily evaluate the mail configuration in your PHP script.You can only specify your own From: clause in the 5th parameter of mail(), which overrides the default of the mail server and finally apply the same value to Bcc:



Actually let get it understood that all To From Email Values has been passed and SMTP Mail Server on Port 25 is working fine... Emails TO: to@gmail.com From: from@mydomain.com Bcc: bcc1@gmail.com, bcc2@gmail.com had receive successfully mails. Now, I again repeating:

The same Message would be derived to the all recements. I want to add in each recipients' Message should be contained their own Email Address

How?
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Nobbie » 27. November 2021 17:00

Obviously, you did not understand my answer. Which part is unclear? As i said, you CANNOT evaluate the own email address in PHP, if you do not apply it via From: clause. The only way is to apply your own address via From: clause and also apply it to Bcc:.

Got it now?

Example:

$myaddress = "myemail@mydomain.com";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "Bcc: $myaddress" . "\r\n";

$from = "From: $myaddress";

$message = "
<html>
<body>
Hello $_GET['Bcc'] ;
Its a test message.

</body>
</html>
";

mail($to,$subject,$message,$headers,$from);
Nobbie
 
Posts: 12256
Joined: 09. March 2008 13:04

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 28. November 2021 03:02

Nobbie wrote:Obviously, you did not understand my answer. Which part is unclear? As i said, you CANNOT evaluate the own email address in PHP, if you do not apply it via From: clause. The only way is to apply your own address via From: clause and also apply it to Bcc:.

Got it now?

Example:

$myaddress = "myemail@mydomain.com";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "Bcc: $myaddress" . "\r\n";

$from = "From: $myaddress";

$message = "
<html>
<body>
Hello $_GET['Bcc'] ;
Its a test message.

</body>
</html>
";

mail($to,$subject,$message,$headers,$from);



My Question was:
Actually let get it understood that all To From Email Values has been passed and SMTP Mail Server on Port 25 is working fine... Emails TO: to@gmail.com From: from@mydomain.com Bcc: bcc1@gmail.com, bcc2@gmail.com had receive successfully mails. Now, I again repeating:

The same Message would be derived to the all recements. I want to add in each recipients' Message should be contained their own Email Address



You should not waist my Time I didn't write in any other language but ENGLISH. You every time trying to Teach me Syntex of mail() function. I know all what you trying to teach. If you do not want to answer do not reply.
I think you are cannot understand English!
Please do not answer otherwise other Developers would not answer my question do not try to make trash box.
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 28. November 2021 03:07

Altrea wrote:I read the message, but probably i don't understand it.



Actually let get it understood that all To From Email Values has been passed and SMTP Mail Server on Port 25 is working fine... Emails TO: to@gmail.com From: from@mydomain.com Bcc: bcc1@gmail.com, bcc2@gmail.com had receive successfully mails. Now, I again repeating:

The same Message would be derived to the all recements. I want to add in each recipients' Message should be contained their own Email Address
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Altrea » 28. November 2021 03:39

WE are wasting YOUR time?
You might write in english, but your words doesn't make any sense to me.

I want to add in each recipients' Message should be contained their own Email Address

What does that mean? Can you give us an example?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11300
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby zahidaliayub » 28. November 2021 04:04

Altrea wrote:WE are wasting YOUR time?
You might write in english, but your words doesn't make any sense to me.

I want to add in each recipients' Message should be contained their own Email Address

What does that mean? Can you give us an example?


$_GET["Bcc"] = " bcc1@gmail.com,bcc2@gmail.com,bcc3@gmail.com";

$to = "To: to@gmail.com";
$from = "from@gmail.com";
$bcc = $_GET["Bcc"];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

$headers .= "From: $from" . "\r\n";
$headers .= "Cc: $cc" . "\r\n";

$headers .= "Bcc: $bcc" . "\r\n";

$eachone = explode(",", $_GET["Bcc"]);


$message = "
<html>
<body>
Hello $eachone[1];
Its a test message.
thanks
</body>
</html>
";

mail($to,t$subject,$message,$headers);


Recipient should receive!

Hello bcc2@gmail.com,
Its a test message.
thanks

while message of others should be:

Hello to@gmail.com
Its a test message.
thanks

Hello from@gmail.com
Its a test message.
thanks

Hello bcc1@gmail.com
Its a test message.
thanks

Hello bcc3@gmail.com
Its a test message.
thanks


etc.
User avatar
zahidaliayub
 
Posts: 7
Joined: 25. November 2021 05:20
XAMPP version: 3.3.0
Operating System: Windows 10 Pro

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Altrea » 28. November 2021 09:42

now its clear. You want a personalized salutation for each recipiant.
That is technically not possible. That is not how emails are working (at least not by sending a single email).

What you maybe want to use is a mass mailing script, which would send multiple mails (one for each recipiant). Then it is for sure possible to place the personalized salutation before the email is sent.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11300
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: PHP SMTP : each Bcc <email> into their own email Message

Postby Nobbie » 28. November 2021 11:48

I can understand english very well, but your english is no english. But that is not the main problem, obviously you cannot explain the goal of your project precisely. Your question is a total mess. Last not least you are wasting our time. And last not least there is no way to send personalized messages with only one body. You would need to have kind of JavaScript or similar in Email bodys to achive that, but there is no such thing as email clients dont know any script languages. You can only send static text.

P.S.: The confusion comes due to your poor english in conjunction with your wording. The whole email thing is a message, but what you are looking for is called email body. Nobody calls it message (besides you).
Nobbie
 
Posts: 12256
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 103 guests