Solved

cc in an email using smtp control

Posted on 2004-10-08
4
315 Views
Last Modified: 2010-04-17
Hi,
Is there a way to send a message to a someone in the normal way using a smtp control but include the cc header for a particular user without actually cc'ing it to the user.  For example, if someone has already been cc'd and I am just using an smtp control to sending a copy to somebody else, I'd like that new user that I'm sending to.. to still know that a particular user has been cc'd but not re-cc it to them.  If I add the cc header the mail server actually cc's it as it's supposed to of course so I'd like to see if I can add a cc header somehow for looks only.  Thanks.
0
Comment
Question by:jodyglidden
  • 3
4 Comments
 
LVL 3

Expert Comment

by:Tyrsis
ID: 12261990
In the DATA section of an SMTP mail, you simply add CC: email@example.com to the header section of the DATA part of a mail, where email@example.com is the email of the user that was CC'd.  This will show the email of the user you are CCing without actually ever sending anything to them.  If you set a RCPT TO:<email@example.com> and email@example.com is the person who is being cc'd, then that is when they will receive a copy of the mail (of course that is if the SMTP server allows relaying, which most don't these days).

Tyrsis
0
 
LVL 1

Author Comment

by:jodyglidden
ID: 12262042
Hi,
Sorry, I'm not familiar with the DATA section of the headers.  I've worked quite a bit with headers and with message bodies but I lost you on this part.  Would you mind explaining that part a bit further?  Thanks for your help so far.
0
 
LVL 3

Expert Comment

by:Tyrsis
ID: 12262160
Oh, I was assuming that the SMTP control or component you were using allowed pretty raw access to the data it is sending to the SMTP server.  An SMTP server works in the following way.  You log into it and send a HELO (or EHLO command).  The server responds.  You send a MAIL FROM:<email> to the server, another response, RCPT TO:<email>, response, and if all goes well you send a DATA command, then you start sending the body of the email followed by a period (.), which terminates the "body" of the email basically.  But in that body is where the headers sit (ie: Subject, Date, From, CC and some other lines that an email client uses).  Anyway, what I suggest is, if there is some sort of header variable that can be added to, try adding a CC: email@example.com to it.  If it is actually SENDING to that CC then you have a problem, and it sounds as though the control is trying to do something you don't want it to do.  
0
 
LVL 3

Accepted Solution

by:
Tyrsis earned 500 total points
ID: 12262832
Let me expand on the nature of CC's as well here.  If you want to CC someone, in reality what you do is actually connect to their smtp server (in the case of email@example.com, you would connect to mail.example.com (or whatever mx address is returned by the DNS for example.com)) and you would send a mail to them like normal, but after the DATA command, instead of putting To: email@example.com, you would put CC: email@example.com.  So basically there is no real difference between sending something TO someone and CC to someone.  It just gets displayed different or handled different depending on the email client used.  It is just basically a header that is parsed.  The SMTP server doesn't actually DO anything with this information, except send it to the user, and the user's email program is what displays it differently.  

So in a situation like above, where you have two users.  Let's say you want to send a mail TO jody@hotmail.com and a CC to user@example.com.  Your email program would first do an MX DNS lookup on hotmail.com and then on example.com.  Get the mail server IP addresses for those two domains.  It then connects to hotmail.com.  Does a HELO, MAIL FROM, RCPT TO:<jody@hotmail.com> (this tells the server who you're sending to), then DATA, then your email body including headers which include To: jody@hotmail.com and CC: user@example.com.  After that it does the same thing with the MX address returned for example.com.  Except when sending the RCPT TO: line it puts user@example.com instead of jody@hotmail.com.

Anyhow, this is as low level as it gets.  A good reference for how SMTP and POP3 works is to look at the RFC and STD documents.  They are available at www.rfc-editor.org.  Just do a search for SMTP and POP3 at that URL.  Having an understanding how the low level stuff works will probably help you figure this all out pretty easily.  

Tyrsis
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count8 challlenge 13 87
wordcount challenge 11 78
wordappend challenge 8 86
Installed softare without GUID 6 55
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now