Jump to content

Send email with language


Oldemaren

Recommended Posts

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.

Link to comment
Share on other sites

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 by Oldemaren
Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
}


 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.