Oldemaren Posted August 17, 2020 Share Posted August 17, 2020 I have mixed text with emails. Some are .com, .co.uk, .it, .se, dk, de, and so on. <form action="mail.php" method="post"> <textarea name="emails" value="emails"></textarea> <input type="submit" value="Subscribe"> </form> <?php $emails = $_POST["emails"]; //$email = explode/ltrim/array/string/all of that echo $emails; All the emails, unfortunately. blabla1@hotmail.com blabla2@hotmail.de blabla3@yahoo.com blabla4@hotmail.es blabla5@gmail.es ... But how can I have with one language, example I would have only .de: blabla1@hotmail.de blabla2@hotmail.de blabla3@gmail.de blabla4@yahoo.de blabla5@gmail.de ... and next I would have only .se, and so on. Can you tell me? I am newbie. Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/ Share on other sites More sharing options...
requinix Posted August 17, 2020 Share Posted August 17, 2020 Going to need more information than that. What are these emails? Where are they coming from? Why are they so mixed up if you don't want them to be? Why are you trying to change them to be from different domains? Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580694 Share on other sites More sharing options...
Oldemaren Posted August 17, 2020 Author Share Posted August 17, 2020 I have ESP (mailchimp.com), but it's mixed up from email, or you can have English value, but thats no good for me. Can you have with one mail language (.co.uk), then another mail language (.se) then another mail language (.it) and so on? Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580696 Share on other sites More sharing options...
requinix Posted August 17, 2020 Share Posted August 17, 2020 It depends on the service. I don't think you can safely change everything: some of them may use the same mail system for all of the domains, some of them might not. What's wrong with the original email addresses? Why do they have to change? Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580698 Share on other sites More sharing options...
Oldemaren Posted August 17, 2020 Author Share Posted August 17, 2020 (edited) I have English and only English. But I rather have also blabla@gmail.it, blabla2@live.it, etc for Italy, blabla1@yahoo.se, blabla2@gmail.se, etc for Swedish and so on. $emails = explode, ltrim, array, string or something Edited August 17, 2020 by Oldemaren Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580700 Share on other sites More sharing options...
requinix Posted August 17, 2020 Share Posted August 17, 2020 It doesn't matter what the domain is. It's just an email address. Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580702 Share on other sites More sharing options...
Oldemaren Posted August 17, 2020 Author Share Posted August 17, 2020 ok then, but let us forget email, there is past. Here is a new: <form action="name.php" method="post"> <textarea name="name" value="name"></textarea> <input type="submit" value="Subscribe"> </form> <?php $name = $_POST["name"]; //$name = explode/ltrim/array/string/all of that echo $names; All the names, unfortunately: (name, textarea) Tom Thomsen, England John Johnsen, Italy James Jensen, Italy Jamie Stalker, Sweden Almost the same as email, but new name and countries. How can I have many italies in one groups, and then english groups in second group and so on? Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580704 Share on other sites More sharing options...
requinix Posted August 17, 2020 Share Posted August 17, 2020 Start with an empty array where you will store everything. Use explode() to split the whole textarea string into an array of all the lines. Then use a loop to go over all those lines. Split each line into a name and a country. Check if the empty array from before has an entry according to the country. If it does not, add it as a (sub) array. Append the name to that (sub) array. Try writing the code for that. If you have problems, post what you wrote. Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580705 Share on other sites More sharing options...
Oldemaren Posted August 17, 2020 Author Share Posted August 17, 2020 Name or email. It doesn't work for me. I am newbie to this. <form action="mail.php" method="post"> //or name.php <br><textarea name="emails" value="emails"></textarea> //or names <br>Email <input type="submit" value="Subscribe"> //or Name </form> <?php //emails or name, the same $emails = $_POST["emails"]; $emails = explode($emails); echo "<br>test=".$emails; //$emails = Remove/delete almost all countries, except .se (email: "name@gmail.se" or name: "FirstName LastName, Sverige") $emails = array(stristr($email, '@')); foreach( $emails as $email ) { echo "<br>test".$email; } Quote Link to comment https://forums.phpfreaks.com/topic/311339-send-email-with-language/#findComment-1580716 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.