CoreNetwork CNetwork;
NetworkClient NClient;
ostringstream OStrMsg, OStrMailto;
// TODO: Suppose to be lower after dumb, send email by some mail class instead of usine client
PDNS_RECORD rr;
char * name="yahoo.com";
// DnsQuery_A(name, DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &rr, NULL); DNS_TYPE_MX?
// TODO: Watch out for the specific line breaks! very important!
ostringstream Text;
NClient.Initialize (CNetwork, "mx4.mail.yahoo.com", 25);
NClient.Send ("EHLO yahoo.com\r\n");
NClient.Send ("MAIL FROM:<oferstu@yahoo.com>\r\n");
NClient.Send ("RCPT TO:<oferstu@yahoo.com>\r\n");
NClient.Send ("DATA\r\n");
NClient.Send ("SUBJECT: Test\r\n");
NClient.Send ("FROM: End user<oferstu@yahoo.com>\r\n");
NClient.Send ("TO: Company name<oferstu@yahoo.com>\r\n");
NClient.Send ("MIME-Version: 1.0\r\n");
NClient.Send ("Content-type: multipart/mixed; boundary=\"simple boundary\"\r\n");
NClient.Send ("\r\n--simple boundary\r\n");
NClient.Send ("Content-Type: text/plain; charset=us-ascii\r\n\r\n");
NClient.Send ("This is the preamble. It is to be ignored, though it\r\n");
NClient.Send ("\r\n\r\n--simple boundary\r\n");
NClient.Send ("Content-Type: application/x-whatever; name=\"memory.dmp\"\r\n\r\n");
NClient.Send ("Content of the email\r\n");
NClient.Send ("\r\n\r\n--simple boundary--\r\n\r\n");
NClient.Send ("\r\n.\r\n");
string testy;
DWORD counter;
NClient.Send ("QUIT\r\n");
Text << NClient.RecieveTextLine ();
Text<<"\r\n";
for (counter=0; counter<100000; counter++)
{
testy = NClient.RecieveTextLine ();
Text<<testy<<"\r\n";
if (*testy.c_str()=='2' && *(testy.c_str()+1)=='2' && *(testy.c_str()+2)=='1')
break;
}
Resolving a bulky situation
I was able to send email to my mail box as I wanted. However, the email reach into my bulk (spam) folder. How do I make it reach my inbox instead? Here is the code:
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.
Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
I'd say set a special header and let your mail program recognize that as "good"
Yahoo thinks the mail is spam. Either change your mail filter so it lets that mail through, or change the message so Yahoo doesn't think it's spam. How you do that depends on their spam filter - but I'd imagine the source address being a yahoo address and it not comming from a yahoo mailbox is a big red flag.
You don't, plain and simple.
Something about the content of your e-mail has caused the software the recieved, processed, and eventually delivered it to you to determine that the email was spam. There's nothing you can do about this, really, except improve the content of your message so it doesn't get considered spam. That's not a science, as everybody will have different e-mail filtering in place.
If the email will only ever go to you, you can do as the above posters have suggested.
Something about the content of your e-mail has caused the software the recieved, processed, and eventually delivered it to you to determine that the email was spam. There's nothing you can do about this, really, except improve the content of your message so it doesn't get considered spam. That's not a science, as everybody will have different e-mail filtering in place.
If the email will only ever go to you, you can do as the above posters have suggested.
Quote:
Original post by Evil Steve
Yahoo thinks the mail is spam. Either change your mail filter so it lets that mail through, or change the message so Yahoo doesn't think it's spam. How you do that depends on their spam filter - but I'd imagine the source address being a yahoo address and it not comming from a yahoo mailbox is a big red flag.
What do you mean not coming from a yahoo mail?
How can the server tell from where the mail is coming from? Its just a session between to programs?
About the content, when I sent the mail without any content, but with only the subject, it reached the bulk as well.
So I dont think its the content. Something is missing.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.
Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
You should look at the headers that an e-mail program such as Eudora or Outlook Express send when sending e-mail, and compare the headers. You likely need the Return-Path:, Content-Class:, Content-Type:, Content-Transfer-Encoding: and Message-ID: headers. It probably doesn't hurt if the "from" part is actually within the domain that the e-mail is being forwarded from, either.
enum Bool { True, False, FileNotFound };
I think you'll find that hplus0603 is correct:). If I remember correctly when I was trying to do something similar, not having the proper headers, or more spefiically, the headers my email program wanted was the quickest way to get a message marked as spam.
At the very least you should have the message-id: and return=path correctly filled out.
Perhaps your library will do it for you??
Cheers
Chris
[Edited by - chollida1 on August 1, 2006 2:39:05 PM]
At the very least you should have the message-id: and return=path correctly filled out.
Perhaps your library will do it for you??
Cheers
Chris
[Edited by - chollida1 on August 1, 2006 2:39:05 PM]
CheersChris
What I did is to create a folder in yahoo, and set a filter that put mails with a certain data into this folder (is this dangerous?).
I have now another problem.
Apparently the .dmp file doesnt transfer very good.
I tried to send a text file, and saw that the line breaks dissappear.
I have tried to send it as binary, but it didnt help for the text file and I also guess for the .dmp file.
Here is my code as for now:
EDIT: Changed to octet-stream, still doesnt work
I have made a small discovery,
If in my source text file I have "\r\n", then in the sent text file I downloaded from my email there is only "\n".
[Edited by - The C modest god on August 2, 2006 3:51:48 AM]
I have now another problem.
Apparently the .dmp file doesnt transfer very good.
I tried to send a text file, and saw that the line breaks dissappear.
I have tried to send it as binary, but it didnt help for the text file and I also guess for the .dmp file.
Here is my code as for now:
CoreNetwork CNetwork; NetworkClient NClient; NClient.Initialize (CNetwork, this->ServerName, 25); NClient.Send ("EHLO "); NClient.Send (this->HostName); NClient.Send ("\r\n"); NClient.Send ("MAIL FROM:<"); NClient.Send (this->FromMail); NClient.Send (">\r\n"); NClient.Send ("RCPT TO:<"); NClient.Send (this->ToMail); NClient.Send (">\r\n"); NClient.Send ("DATA\r\n"); NClient.Send ("SUBJECT: "); NClient.Send (this->Subject); NClient.Send ("\r\n"); NClient.Send ("FROM: "); NClient.Send (this->FromName); NClient.Send ("<"); NClient.Send (this->FromMail); NClient.Send (">\r\n"); NClient.Send ("TO: "); NClient.Send (this->ToName); NClient.Send ("<"); NClient.Send (this->ToMail); NClient.Send (">\r\n"); NClient.Send ("MIME-Version: 1.0\r\n"); NClient.Send ("Content-type: multipart/mixed; boundary=\"simple boundary\"\r\n"); NClient.Send ("\r\n--simple boundary\r\n"); NClient.Send ("Content-Type: text/plain; charset=us-ascii\r\n\r\n"); NClient.Send (this->TextContent); NClient.Send ("\r\n\r\n--simple boundary\r\n"); NClient.Send ("Content-Type: application/octet-stream; name=\""); NClient.Send (this->FileName); NClient.Send ("\"\r\n"); NClient.Send ("Content-Transfer-Encoding: base64\r\n\r\n");// NClient.Send ("\"\r\n\r\n"); NClient.Send (this->FileData); NClient.Send ("\r\n\r\n--simple boundary--\r\n\r\n"); NClient.Send ("\r\n.\r\n"); NClient.Send ("QUIT\r\n");
EDIT: Changed to octet-stream, still doesnt work
I have made a small discovery,
If in my source text file I have "\r\n", then in the sent text file I downloaded from my email there is only "\n".
[Edited by - The C modest god on August 2, 2006 3:51:48 AM]
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.
Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Newlines are translated in mail passage. When sending to an SMTP server, all newlines should be sent as \r\n. When receiving, your mail user agent may do one of many things with them.
If you depend on the specific file format, you must send the mail using some MIME encoding, such as base-64.
If you depend on the specific file format, you must send the mail using some MIME encoding, such as base-64.
enum Bool { True, False, FileNotFound };
Quote:
Original post by hplus0603
Newlines are translated in mail passage. When sending to an SMTP server, all newlines should be sent as \r\n. When receiving, your mail user agent may do one of many things with them.
If you depend on the specific file format, you must send the mail using some MIME encoding, such as base-64.
In my code I changed binary into base64.
When I send using the base64 encoding I get a file that is smaller then the original.
At first, yahoo says its 15kb (instead of 20kb) and when I try to download it, it says its 2Kb and the downloaded file is actually 2Kb.
What could be wrong with it?
Ok, I understand I need to encode my data myself in base64?
[Edited by - The C modest god on August 2, 2006 3:02:41 AM]
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.
Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement