Accented characters in email fields

I'm using this script to have email sent to me through a mail form:
<?php
// initialize variables for To and Subject fields
$to = '[email protected]';
$subject = 'Een testmail';
$from = $_POST["from"];
$email = $_POST["email"];
$comments = $_POST["comments"];
// build message body from variables received in the POST array
$message = "Van: $from \n\n";
$message .= "Email: $email \n\n";
$message .= "Bericht: $comments";
$message = stripslashes($message);
//convert flash line breaks
$message= str_replace("\r", "\n", $message);
$message=nl2br($message);
// add additional email headers for more user-friendly reply
$additionalHeaders  = "From: $from <".$email.">\r\n";
$additionalHeaders .= "Reply-To: ".$email."\r\n";
$additionalHeaders .= "MIME-Version: 1.0\r\n";
$additionalHeaders .= "Content-type: text/html; charset=utf-8\r\n";
// send email message
$OK = mail($to, $subject, $message, $additionalHeaders);
// let Flash know what the result was
if ($OK) {
  echo 'sent=OK';
  else {
  echo 'sent=failed&reason='. urlencode('Er is een probleem met de server. Probeer het later nog eens.');
?>
The problem is that I can't get accented characters appear into the From: cc: bcc: fields. For example, when I fill the From field with 'René' it appears as 'RenX' in the From: field. I've set everything to utf-8 but that doesn't seem to matter. When I receive an html text mail, the From: fields displays accented characters as strange codes, like RenA@ or RenX for René.
In the message text itself it varies: it either displays René when the mail is viewed as plain text mail, or RenA@ when the mail is views as html text. How can I get accented characters appear inside email fields too? And also in the body text when the email is viewed as html text?

It comes down to this. Since flash outputs in utf-8 I used utf-8 in here too. But narrowing it down to the most basic part:
<?php
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset= UTF-8\r\n";
$headers .= "From: René <[email protected]>\r\n";
$OK = mail('[email protected]', 'A question', 'René is my name', $headers);
if ($OK) {
  echo 'sent=OK';
  else {
  echo 'sent=failed&reason='. urlencode('There is a problem with the server. Try again later.');
?>
When I view this through webmail I get to see RenX in the From field where it should be René. Changing charset to ISO8859-1 won't work either. I get RenX in the From field and RenA@ in the message part. And when I switch in webmail from text/html to text/plain it says Ren? in the message part.
How can I make it display René in all headers and message? Both in html mode and in plain text mode?

Similar Messages

  • Strange characters in email Subject field

    I don't quite know where to post this one, but since I'm always programming only .jsps and servlets I hope someone will answer this here.
    Accented characters in subject field of our emails produced by our programmes are being replaced by nonsense like the following:
    =?ANSI_X3.4-1968?Q?
    In the body of the email I can just replace accented characters with html equivalents, no problem, but not in the subject field.
    Is there a way round this, like setting the character encoding somewhere or whatever? I use the javamail API to produce these emails - is there anything in the API for this?
    Any help would be much appreciated.

    I think e-mail only allows only ASCII characters in certain fields? I think you'd have to read the email RFC to find out the details of that.
    http://www.faqs.org/rfcs/rfc2822.html
    That's a start, but there are certain extensions to that, I think, that might atler things... Otherwise, you'd have to check thru the JavaMail API docs and see if there's an encoding setting somewhere.

  • Non-ASCII character in Email field

    Hi Guys,
    I am trying to enter non-english characters in Email field of user form, but OIM throws an error that "A non-Ascii character has been entered". I have also tried to turn off the AppFirewall Filter in xlConfig.xml file but no help. Is there any way thay I can enter non-Ascii characters in Email field?
    Regards,
    Rahul

    .oO(surfinIan)
    >I have a script that converts a ms word document to text
    then uploads that to a
    >blob field on a mysql db.
    > During the conversion some characters my not be
    recognised. When i then call
    >up the blob for display on the browser...those characters
    show up as unknown
    >characters with a ? or box. Is there a way to
    preg_replace those unknown
    >characters before displaying them.
    What about fixing the encoding problem instead? If chars get
    lost during
    such a transfer
    document->script->database->script->browser it's always
    an encoding problem somewhere down the road.
    The recommendation these days is to use UTF-8, which avoids
    most of
    these old problems. You just have to make sure that your
    documents are
    properly stored as UTF-8 in the database and delivered as
    such to the
    script and the browser, then you don't have to worry about
    special chars
    anymore.
    That's just the general idea. I can't be more specific, since
    I don't
    know your conversion script or the database structure.
    Micha

  • Accented characters lost in description of alias email address

    I recently noted that accented characters are lost in long name description of email alias address when using Mail.app but ok when using webmail in iCloud.com
    Setup in the prefs of the master mail account in iCloud, the long name description "Frédéric" for the corresponding alias <[email protected]>
    is transcripted as "Frdric" in Mail.app when selecting the sender address in the dropdown list box
    However, all is fine when using webmail within iCloud.com
    The problem appears only with OSX not with iOS
    I have been using my alias with accented char in its long name description for the last 4 years with Leopard, Snow Leopard and Lion until recently. I can replicate on 3 differents Macs. Even tried to create a new user account. Same stuff.
    Any views? Can someone replicate?

    I found the same problem but only when creating an alias. The dropdown menu on mail app is not showing the accent and when is sent the name arrives to the sander as-is without the letter carrying the accent. No problems on iCloud interface though.
    See, first one is my main icloud account, the second one is an alias account on icloud. Both have the same ó character but only shows in the main one.
    Will someone help us fix that? Will apple fix that weird iCloud behavior?

  • Accented characters showing up as ? in JRE1.3 but ok in 1.2

    I'm implementing a database web interface product that utilizes JSPs (on SunOS 5.7).
    The problem is in the search form. When using accented characters (French language), the JSP calls on URLEncode, but all accented characters show up as '?'.
    However, when editing a record, using accented characters is not a problem (i.e., the accented characters are properly stored in the fields).
    Back on the server, I ran a small program to output accented characters and also to call java.net.URLEncoder to convert the characters.
    The default JDK is J2SE (1.3.1). Compiliing and running the program results in question marks.
    Using JDK 1.2, the accented characters show up fine.
    It would appear that URLEncoder is not at fault, but instead, JDK 1.3.1 doesn't seem to handle the accented characters.
    I figure there must be a setting somewhere, but I'm not sure where.
    Here's the program I used (written in Win98, using standard Win-based character set and Unicode format \u00xx; in Unix, "more" displays the Win accented characters fine but "vi" displays them as \xxx; compiles and displays perfectly when using JDK 1.2):
    import java.net.*;
    class mine {
    public static void main(String args[]) {
    System.out.println("�����������") ;
    System.out.println(URLEncoder.encode("�����������")) ;
    System.out.println("\u00e0\u00e2\u00e4");
    System.out.println("\351");
    System.out.println("\351\347\356\364\373\340\350\342\344\374\357") ;
    The output with JDK 1.2 is:
    �����������
    %E9%E7%EE%F4%FB%E0%E8%E2%E4%FC%EF
    ���
    The output with JDK 1.3.1 is:
    %3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F

    Between jdk1.2 and jdk 1.3 the default encoding of the vm changed.
    You can get it by executing:
    System.out.println("Default Encoding:" + System.getProperty("file.encoding"));
    or
    System.out.println("Default Encoding:" + (new java.io.InputStreamReader(System.in)).getEncoding());
    The default encoding is used during the conversion of bytes to strings and vice verca.
    Assume your default encoding is ISO8859_1. Then calling new String(byte[]) is equivalent to calling
    new String(byte[], "ISO8859_1")
    Now if you are converting a character from one encoding scheme to another and there is no mapping
    for this character in the target scheme. Then the character will be replaced by a default character
    which is (quite often) the question mark.
    You can set the default encoding for a vm by passing it as a command line parameter
    java -Dfile.encoding=ISO8859_1
    java -Dfile.encoding=Cp1252

  • Problems with Greek accented characters

    After the update to AIR 2.0.2 I cannot input into any application greek with accented characters.
    Tried TweetDeck and Twhirl and neither work (used to before the update)
    Is this a bug or it needs some configuration
    I am working on Fedora13 but heard the same problem reported on Ubuntu.
    Have not tried on MS Windows or MacOSX

    Hi,
    I'm using Adobe AIR 2.0.3 on Windows machine. I wrote an app in Aptana Studio (build: 2.0.5.1278522500) with ExtJS library and I found the problem with polish national characters like ż and Ż (all the other national characters like ą, ę, ń are possible to input).
    In order to reproduce, here you have the sample code in ExtJS:
    http://dev.sencha.com/deploy/dev/examples/form/anchoring.html
    As you will see - it is possible to input ż and Ż in text fields.
    Now, use the same code to build AIR applicaton and then run the application. It is not possible to input those characters in Air window. Right Alt+z acts like undo operation - it removes last entered text. All the other characters work fine.
    Here is the code I used:
    <html>
        <head>
            <title>New Adobe AIR Project</title>
            <link rel="stylesheet" type="text/css" href="lib/ext/resources/css/ext-all.css" />
            <link rel="stylesheet" type="text/css" href="lib/ext/air/resources/ext-air.css" />
            <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
            <script type="text/javascript" src="lib/ext/adapter/ext/ext-base.js"></script>
               <script type="text/javascript" src="lib/ext/ext-all.js"></script>
            <script type="text/javascript" src="lib/ext/air/ext-air.js"></script>
            <script type="text/javascript">
            Ext.onReady(function(){
        var form = new Ext.form.FormPanel({
            baseCls: 'x-plain',
            labelWidth: 55,
            defaultType: 'textfield',
            items: [{
                fieldLabel: 'Send To',
                name: 'to',
                anchor:'100%'  // anchor width by percentage
                fieldLabel: 'Subject',
                name: 'subject',
                anchor: '100%'  // anchor width by percentage
                xtype: 'textarea',
                hideLabel: true,
                name: 'msg',
                anchor: '100% -53'  // anchor width by percentage and height by raw adjustment
        var window = new Ext.Window({
            title: 'Resize Me',
            width: 500,
            height:300,
            minWidth: 300,
            minHeight: 200,
            layout: 'fit',
            plain:true,
            bodyStyle:'padding:5px;',
            buttonAlign:'center',
            items: form,
            buttons: [{
                text: 'Send'
                text: 'Cancel'
        window.show();
            </script>
        </head>
        <body>
        </body>
    </html>
    Is it possible to input those characters or is there a workaround for this (disable undo operation or so) ?
    I really appreciate any help.
    Kind regards,
    Marcin.

  • Accented characters on E70

    Does anyone know if there's an easy way to input accented characters (like é en ä) on the E70 with the phone folded open? I would have expected that switching to Dutch would change the input mode such that pressing for instance e and ' consecutively would give an é, but no such luck. Right now, the only way of entering accented characters that I know of using the full keyboard is holding the control key while pressing the ascii code of the desired character, which is inconvenient even for the few characters for which I know the ascii code by heart. Alternatively, one can close the full keyboard and use the numerical keypad to cycle through the available characters, but constantly switching between the full keyboard and the numerical keyboard is'n really my idea of convenient text input. Thanks, René (that would be Ren<CTRL><233> :-) )

    The capitalization help is a feature I'd like to turn off.
    It hinders me a lot more than it helps.
    The first line of any SMS or email I send always begins with a lowercase letter - very unprofessional - because the UI has already pressed the shift key. When I press the shift key, to capitalize, it un-capitalizes for me.
    I can't correct this habit of hitting the shift key each time I want to capitalize a letter - no other GUI does this to me. Normally, when you begin a sentence, you type a capital letter. But if the phone's UI sees a period, it automatically presses Shift for you.
    This means every time you abbreviate something and use a period midsentence in an SMS, the next leter is capitalized, viz. This example.
    or "it hinders my typing in emails, sms, etc. And is really annoying. this uncapitalized sentence would be another example."
    Anyway how do I turn the thing off because it only wastes my time.
    I find myself trying to outwit and predict this auto-cap behavior and I'm tired of it.
    How do I turn it off?

  • Accented characters, XML, Flash

    I have a flash application which is pulling information to
    populate dynamic fields from two XML files. We have three
    languages supported, and have been having problems with the
    non-english accented characters displaying properly
    when they are called from the XML. I have checked that the
    XML files are encoded in UTF-8, and we have also tried writing
    the html code, the unicode code, putting the information in a
    C DATA shell. I'm out of options that I can think of, and I'd
    appreciate if any other folks have some input on this issue.
    I did find this other thread which seems to be about the same
    issue, but there was no resolution given on it.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=194&threadid =1212142&highlight_key=y&keyword1=accent%20characters

    So the same questions arise. What happens in the testing
    environment if you trace it or if you go Debug and list variables?
    Also you say they aren't displaying properly. What does that
    mean? Exactly how are they improper?
    PS: I'm absolutely certain that the other thread was not
    correctly saving as UTF-8.

  • Reading of accented characters in US-ASCII format in Exchange 2010

    I finished a migration from Exchange 2003 to Exchange 2010.
    I have one unsolved problem. An internal application generates and sends automatically reporting mails using the US-ASCII format through an anonymous Exchange 2010 Receive connector. This connector was configured following the Microsoft recommandations (article
    "Allow Anonymous Relay on a Receive Connector",
    http://technet.microsoft.com/en-us/library/bb232021(printer).aspx).
    The problem is that accented characters like "é", "è" or "à" are converting in "?" when the reporting mails arrive in the user mailboxes in Exchange 2010.
    I made the following test :
    1. When I generate from the shell in Powershell a mail in US-ASCII format, the accented characters are converted to ?
    $encoding = [System.Text.Encoding]::ASCII
    Send-MailMessage -To '[email protected]' -Subject 'Test' -Body 'Test mail avec des é è à et @' -SmtpServer '172.16.3.55' -From
    '[email protected]' –encoding $encoding
    2. When I generate from the shell in Powershell a mail in UTF7 format, the accented characters remains unchanged in the mailbox :
    $encoding = [System.Text.Encoding]::UTF7
    Send-MailMessage -To '[email protected]' -Subject 'Test' -Body 'Test mail avec des é è à et @' -SmtpServer '172.16.3.55' -From
    '[email protected]' –encoding $encoding
    Is there a solution to keep the accented characters without changing the US-ASCII message format in the reporting application ?
    Best regards,
    Pascal

    hi,
    I think it is by design.
    In an Exchange Server 2010 organization, content conversion is handled by the categorizer on a server that has the Hub Transport server role installed. Categorization on each message happens after a newly arrived message is put in the Submission queue. In
    addition to recipient resolution and routing resolution, content conversion is performed on the message before the message is put in a delivery queue.
    Please see this link:http://technet.microsoft.com/en-us/library/bb232174.aspx
    thanks,
    CastinLu
    TechNet Community Support

  • Accented characters again, this time in WEB module

    Hi,
    today I made an amazing discovery: even if the language and user interface of LR (2.0) is set to German, there is no provision to deal with accented characters (üöä) in the web galleries. These are taken directly into the generated html files.
    Some web servers can deal with that, some can not and need \&\a\u\m\l\; (w/o backslashes) instead of ä. LR does not do the conversion. One could say that now that I know I should just enter directly the html code. Well, the problem with that is that I might have keywords or a caption with accented characters that I want to display in the web gallery. Also, the (next|previous) marks for switching pages are (Weiter|Zurück) in German and there I have the problem. I don't even know, where the HTML templates are hidden, maybe I could change Zurück to html code there.
    What can I do about this? Can anyone help?
    Thanxx, PM

    In article <[email protected]>,
    [email protected] wrote:
    > today I made an amazing discovery: even if the language and user interface of
    > LR (2.0) is set to German, there is no provision to deal with accented
    > characters (üöä) in the web galleries. These are taken directly into the
    > generated html files.
    If the page's encoding is UTF-8 (check the encoding meta tag) there is
    no need for special characters to be converted to html entities.
    If they don't display correctly it's usually the server serving them as
    ISO-something when it shouldn't. That would need to be sorted out with
    the hosting company.
    Cheers Martin

  • Accented characters in LR for mac.

    Hi all:
    I'm having problems with pictures with "accented characters" in the name. I can work with these pictures, no question mark is shown, and LR can show where the actual file is located. The problem is as following: if I try to sync a folder, then LR says there are x missing files and the same x new files. If I tell LR to proceed, then the "new" pictures loose keywords, tags, edits, etc.
    I have the same pictures and catalog both in windows and in mac (both version 4.4), as I'm trying to swicht, and in windows there is no problem. So it is a particular mac version problem. I tried to check the problem: if I delete these accented characters, then no new nor missing files are detected in sync, but this is not a solution (I have thousends of pictures and I want to keep the accented characters).
    Is there any other solution?
    This same problem has been mentioned several times, but nobody find a good solution. For example in
    http://forums.adobe.com/thread/608096 and in http://lightroomkillertips.com/?p=2778
    Thanks in advance.

    > the problem is that I'm trying to put a "hat" over a consonant
    I suspect you'll find that, the more precise and specific your question, the more greater the likelihood of getting a speedy and helpful answer.
    > Looks like the software only allows the circumflex over vowels.
    > Option-i does work on my computer for vowels. (Built-in
    > keyboard).
    Nonsense. Nothing to do with your keyboard. Btw, you still haven't told us what character you're trying to insert.
    > I guess I will have to use the Equation Editor.
    That's an option, but not the only one. Just for the sake of argument, let's assume it's p-hat (not the party hat, but the symbol for sample proportion).
    (1) Specifically in Word, you can use fields (overstrike). Go to Insert > Field… > Equations and Formulas > Eq; then type
    EQ \O (p,^)
    and confirm. (Note that "EQ" will be inserted by Word automatically, you don't need to type it again.)
    Once you get the hang of it, you won't need to insert it using menu & submenu commands, but by typing and applying styles.
    (2) The right way is Unicode. Currently, Unicode defines >100k codepoints, so, for obvious reasons, it's neither necessary nor practical for most keyboard layouts to be able to access anything but a small subset. You can enter Unicode characters using Character Viewer (aka Special Characters), or, more efficiently, using the Unicode Hex Input keyboard layout.
    If the character is already defined as such in Unicode, eg, for all (upside down A), then hold down Option and type its Unicode hex code, ie 2200 -- ∀. However, p-hat isn't defined as such, so it must be entered as a combining character sequence. The sequence is ((Latin small letter p) + (combining circumflex accent)), or (p + 0302) -- p̂.
    Unfortunately, all is not sweetness and light. Although this is how it should be done, the display may disappoint. Questions 12b and 12c in the respective Unicode FAQ explain what happens and why.

  • Converting XML to Spreadsheet - Problem with Accented Characters

    I have a program that uses an external program to gathers user account information from Active Directory. The external program is .Net, and I execute it from my Java app, which then collects the XML output and saves it in a String variable. So far so good.
    Next it parses the XML and retrieves the values for each field for each user 'record' and stores these values in a String member inside of a class I created called "User".
    At the end of the process, the User class data is written to a file in XML format. Still, so far so good. However, using a text editor, any user names that have accented characters in them have an extra space character after the accented character. E.g. accented "e" becomes "e ". At least that is how it appears in the Textpad editor app that I use.
    Next I have a class called "XMLToExcel", that creates a spreadsheet using Apache's POI library, reads in the XML records , and writes the values for each field into a cell. Here the name with an accented character gives the message "[Fatal Error] <file name>:2617:23: Invalid byte 1 of 1-byte UTF-8 sequence."
    I'm not sure what I can to do fix this, or even where to fix it. I wouldn't mind losing the accented characted and replacing it with an un-accented one.
    Any ideas? I can provide code snippets if that would help.
    -John Gooch

    The text looks the same in Notepad and Textpad. However, I manually added the "encoding" tag with the value of "ISO-8859-1", and the converter no longer complains about invalid characters.
    I added the encoding tag to my application's output file, so the converter should not complain about it on the next run. Unfortunately, the names have been fixed in Active Directory ( the special character was there by mistake ), so I cannot do a live test to be sure that it is fix.
    Thanks for the help, Duke points incoming!

  • Strange characters in email messages

    my email messages have text characters that I cannot read. This is what the messages look like:
    Xä•Aä[[å{A•b@{~ and so on.
    I'm sure it is a simple key punch solution or mail preferences setting but I have tried everything I can think of. If anyone can solve this problem quickly for me I would appreciate it greatly.

    I think e-mail only allows only ASCII characters in certain fields? I think you'd have to read the email RFC to find out the details of that.
    http://www.faqs.org/rfcs/rfc2822.html
    That's a start, but there are certain extensions to that, I think, that might atler things... Otherwise, you'd have to check thru the JavaMail API docs and see if there's an encoding setting somewhere.

  • How to make "SQLPLUS" show me the Brazilian accented characters correctly?

    Hi,
    I have a Oracle9i instance, with this configurations.
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 9.2.0.1.0
    I have a xHarbour DOS Client program that reads, shows in the screen, and write "perfectly fine" a text with Brazilian accentuation stored in a CLOB field.
    Following you can see the sample of the text with Brazilian accentuation in my DOS application http://www.screencast.com/t/U5PXwCEo8
    In order to my xHarbour DOS Client program works fine with this Brazilian accented characters, I must to set:
    SET NLS_LANG=PORTUGUESE_BRAZIL.WE8MSWIN1252
    And all is OK from my xHarbour DOS Client program.
    My problem is because when I query this data manually using a SELECT from any client DOS/WINDOWS program like SQLPLUS, SQLDEVELOPER, TOAD, etc, I get bad characters instead the correct Brazilian accented characters.
    Following you can see the same text into the Toad http://www.screencast.com/t/A1tal2Rtg
    (you will see bad characters instead the correct Brazilian accented characters).
    Following you can see the result of querying this field using a SELECT from SQLPLUS.
    Certifico que por decis„o proferida no processo n§ @@@@@@@@@@@@@@, 
    foi reconhecida a n„o incidˆncia do ITBI na transa‡„o do(s) im¢vel(is) 
    abaixo caracterizado(s), com base no art.156, @ 2§, I, da Constitui‡„o 
    Federal de 1988 e no art.6§, II, da Lei Municipal n§ 1.364 de 19/12/1988. 
    (you will see bad characters instead the correct Brazilian accented characters).
    How to make "SQLPLUS", "TOAD" (and others Windows or DOS Clients programs) show me the Brazilian accented characters correctly?
    Thanks in advance,
    Luigggye
    Edited by: 880676 on Jul 20, 2012 9:08 PM

    This is a duplicate thread. See the answers at Re: How to change the NLS_NCHAR_CHARACTERSET from WE8ISO8859P1 to AL16UTF16 ?

  • Validating Email Field

    Hi
    I am developing a form in which there is an email field which i have to enter in a textArea.
    tell me how can i check whether the entered email id is valid or not.
    Its urgent
    Thanks in advance
    Dhiraj

    In case you are using JDK version prior to 1.4 you can use following function.
    <pre>
    * Validates the structure of the Email Address. This method covers most
    * requirements of the RFC822 specification.
    * @param strEmailAddress Email Address to be validated
    * @return true if validation is successful, false otherwise
    * @see RFC822
    * @see * Online Email Validator
    public static boolean isValidEmailAddress(String strEmailAddress)
              boolean bValid = true;
              // return false if strEmailAddress is either null or empty
              if (isNullorEmpty(strEmailAddress)) {
                   return false;
              // calculate length of the email address
              int iLength = strEmailAddress.length();
              // get the first occurrence of @ char
              int iCharAtPosition = strEmailAddress.indexOf("@");
              // validation fails if @ character is not present
    if (iCharAtPosition == -1) {
         bValid = false;
              // validation fails if @ character found is in the first or last position
    else if ((iCharAtPosition == 0) || (iCharAtPosition == (iLength - 1))) {
         bValid = false;
              // validation fails if more than 1 @ character are present
    else if (strEmailAddress.indexOf("@", iCharAtPosition + 1) > -1) {
    bValid = false;
              else {
                   // traverse thru all the characters in the given email address
         for (int i = 0; i < iLength; i++) {
              // get the character at the i position
         char c = strEmailAddress.charAt(i);
         if (c == '.') {
                             // validation fails if . character found is in the first or last position
              if ((i == 0) || (i == (iLength - 1))) {
              bValid = false;
              break;
         // . character cannot come before @ character
         else if (i == (iCharAtPosition-1)) {
              bValid = false;
              break;
         // all these are invalid characters
         else if ( c > '~' || c < '!' || c == '(' || c == ')' ||
         c == '<' || c == '>' || c == '[' || c == ']' ||
         c == ',' || c == ';' || c == ':' || c == '\\' ||
         c == '"') {
                             bValid = false;
         break;
              // return the validation flag          
    return bValid;
    </pre>

Maybe you are looking for