473,320 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

setRequestHeader method doesn't work with POP3

62
Hello
Refer to the thread that i have posted before: http://www.thescripts.com/forum/thread755824.html

On that time i got problem about encode ajax to send email...everything worked find after i use setRequestHeader and encodeURIComponent...but
then i test it with POP3 mail everything is not encoded...why ? And is it has some way to fix this ?
thank you so much
Paitoon
Jan 23 '08 #1
10 2015
acoder
16,027 Expert Mod 8TB
Show your code. What isn't encoded properly?
Jan 24 '08 #2
paitoon
62
this is some part in my AJAX:
Expand|Select|Wrap|Line Numbers
  1.  
  2.   var params = "sender=" + encodeURIComponent(document.iform.sender.value)+
  3.     "&email=" + encodeURIComponent(document.iform.email.value)+
  4.     "&subject=" + encodeURIComponent(document.iform.subject.value)+
  5.     "&text=" + encodeURIComponent(document.iform.text.value);
  6.  
  7.  
  8. xmlHttp=GetXmlHttpObject()  
  9. var url="process.php"
  10. xmlHttp.onreadystatechange=myResult; 
  11. open("POST",url,true)
  12. xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  13. xmlHttp.send(params)
  14.  
  15.  
  16.  
  17.  
AND THIS IS MY PHP PAGE TO SEND MAIL
[php]<?php
$recipient = 'geisha@hotmail.com';
$params = $_POST['params'];
$subject = $_POST['subject'];
$from = $_POST['sender']; // variable SENDER from ajax
$email = $_POST['email'];
$text= $_POST['text'];
$ip = $_SERVER['REMOTE_ADDR'];

$msg = "From: $from\n Email: $email \n IP Adrress :$ip \n\n Message: $text";
mail($recipient, $subject, $msg);

?>[/php]

Everything worked good in hotmail, gmail, yahoo But not in web-mail or POP3 program.


Please tell me what should i do.
thanks a lot
Alex
Jan 24 '08 #3
acoder
16,027 Expert Mod 8TB
Can you send to a POP3 account without using Ajax?
Jan 24 '08 #4
paitoon
62
Actually yes, But I just want to know if it's possible or what is this problem etc..
Because it's work fine on normail mail but why it doesn't work with web-mail or pop3 ?
actually i was happy after i made everything hard finish and i use the time for this for a month (so hard) but a few days ago i opened it in web-mail and POP3 program it's disappoint me in the end my problem is not really gone...:-/

I did not expect that my site should be 100 % perfect but....i just wonder why ? I also tried to send email from my hotmail to that web-mail in thai language...everything is encoded and it's great work without going to VIEW and choose ENCODE on windows.

This is why i still stress and wonder how hotmail and other normal mail do, and why couldn't I.


But thank you so much at least U lead the way :-)
Alex
Jan 24 '08 #5
acoder
16,027 Expert Mod 8TB
So the text of the email is in Thai?

Have you set the correct headers/charsets? If, in PHP, you send email to the POP3/web-mail account using the mail function with Thai characters, does it send/receive OK?
Jan 24 '08 #6
paitoon
62
eventually i got it,
1. the reason that email not encoded in POP3 program that because i have to set the default encoded in the program to be UTF-8 (before it's western europe)
2. the reason that it's not encoded in web-mail (they use squrrel mail) because they just told me that they are not support asian langage.

Well, i got stress but got much more experiance. And i hope it will be the useful for other people also.

But i still wonder why gmail can do? I send message in Thai language to that POP3 and it's encoded correctly without setting anything.?Because gmail also use ajax.....

Thanks alot for all your help
Alex
Jan 24 '08 #7
acoder
16,027 Expert Mod 8TB
But i still wonder why gmail can do? I send message in Thai language to that POP3 and it's encoded correctly without setting anything.?Because gmail also use ajax...
You can set the header using setRequestHeader, so it must be set to UTF-8.
Jan 25 '08 #8
paitoon
62
So you means in javascript ?'

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

i did it but it make email not work.

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-uutf-8');
Jan 25 '08 #9
paitoon
62
But it ok....i give up
thank you so much
Alex
Jan 25 '08 #10
acoder
16,027 Expert Mod 8TB
I meant something like:
Expand|Select|Wrap|Line Numbers
  1. xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; Charset=utf-8");
Jan 28 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel Albisser | last post by:
Hi @ll, I was wondering why I lose the connection to the mail store while retrieving information from it without calling the method store.close()! At the end I found out that the method...
1
by: Lev Altshuler | last post by:
Hi, I am trying to count email messages in the mailbox and read their headers. In case that there are some messages on the POP3 server and they haven't yet got to the Inbox, I get a number of...
0
by: Eric McDaniel | last post by:
This may be a question for ActiveState support, but just in case anyone out there knows what the problem is... My call to Net::POP3->new() works fine when run through the perl interpreter, but...
5
by: Matt Kruse | last post by:
I'd like to test for Opera8.00's missing setRequestHeader method before actually instantiating the object. For example, this works in firefox: if (XMLHttpRequest.prototype.getRequestHeader) { ......
4
by: Ron Vecchi | last post by:
I a runnning w2k3 pop3 mail server that came with iis6. I would like to write an application that progammtically creates the new mailboxes in an already established mail domain. Does anyone know...
8
by: TJ | last post by:
I need to be able to pass a pointer to a (managed code) Stream object to a COM method so it can serialize its data into the stream. I have a C# application that makes uses of Randolf Duke's...
2
by: Mike Brearley | last post by:
I need to write a script that will check a catch-all mailbox (pop3) and send a non delivery report back to the sender of the email. Background info: I have a domain hosted on a site that offers...
8
by: rithish | last post by:
I am on IE 6. I was trying out a simple xmlhttp function that send GET/POST requests. However, IE throws an 'unspecified error' when I call the 'setRequestHeader' method. The function that I am...
1
by: bobano | last post by:
Hi everyone, I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.