Geeks With Blogs
Joseph Hachey blog
I have started work on a new personal project, ResumeSpammer. ResumeSpammer will do just what its name implies, spam my resume. Contact info of potential employers will be stored in a SQL Express database. For each employer, the application will populate my resume document (.doc) with their contact information and email it to them. There's a bit more to the project than that, but that's the just of it.
 
Today I wrote HacheyORG.ResumeSpammer.Logic.Resume, a class to handle populating and saving my resume with an employer's contact info. To interact with MS Word, I had to use its Primary Interop Assembly (PIA)  It was my first time using Interop Assemblies, and it wasn't enjoyable in the least! I better get comfortable with interops, cause I'm sure I'll run into them again.
 
One hurdle I ran into was not being able to have one MS Word bookmark point to multiple locations in the document. This would have come in very handy for fields such as RecipientName, which appear multiple times in the cover letter. As a workaround, I gave each bookmark location a unique name (ie RecipitentName1, RecipientName2, etc.) and wrote a function that will detect if there are mutliple bookmarks and loop over them.
 
Yesterday I wrote HacheyORG.Lib.MailService, a class that utilizes System.Net.Mail to send emails with optional attachments through a SMTP server. In my case, I wanted to send emails through GMail's SMTP server. I had quite a bit of trouble figuring it out, so I'll post the code for reference. This snippet should work for Yahoo!Mail and HotMail as well, you will just need to figure out their servers' hostname and port.
 
 
 using (MailMessage message = new MailMessage(from, to, subject, body))

{

message.IsBodyHtml = false;

SmtpClient mailClient = new SmtpClient();

mailClient.Host = "smtp.gmail.com";

mailClient.Port = 587;

mailClient.EnableSsl = true;

mailClient.Credentials = new System.Net.NetworkCredential(username, password);

mailClient.Send(message);

}

Posted on Monday, November 21, 2005 2:53 AM My Projects | Back to top


Comments on this post: 2 down...N to go!

# re: 2 down...N to go!
Requesting Gravatar...
Double check the GMail TOS. IMO you are walking a thin line with them since potential employers are typically non-preexisting relationships. This would violate Section 3 of their TOS for GMail. One issue however is that they use the term "significant" in reference to the number of e-mails acceptable. What exactly constitutes a "significant" number of addresses?

I of course don't care, I'm just pointing it out. :-) I could have the "idea" of your software wrong.
Left by Eric Hammersley on Nov 21, 2005 5:47 AM

# re: 2 down...N to go!
Requesting Gravatar...
I think it should be fine. The application will be for my own personal use, and I don't plan on doing any type of data mining, so the number of recipients should be pretty low compared to that of comercial spammers. Thanks for the heads up though. I read the Gmail Terms of Use before starting the project, but didn't follow the link in Section 3.
Left by Joseph Hachey on Nov 21, 2005 6:15 AM

# re: 2 down...N to go!
Requesting Gravatar...
Good, I'm glad you can stear clear of this pitfall. I'm interested to see how your app progresses.
Left by Eric Hammersley on Nov 21, 2005 6:30 AM

Your comment:
 (will show your gravatar)


Copyright © Joseph Hachey | Powered by: GeeksWithBlogs.net