How to develop and test an app that sends emails (without filling someone’s mailbox with test data)? [closed]

I faced the same problem a few weeks ago and wrote this: http://smtp4dev.codeplex.com Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

Send inline image in email

Some minimal c# code to embed an image, can be: MailMessage mailWithImg = GetMailWithImg(); MySMTPClient.Send(mailWithImg); //* Set up your SMTPClient before! private MailMessage GetMailWithImg() { MailMessage mail = new MailMessage(); mail.IsBodyHtml = true; mail.AlternateViews.Add(GetEmbeddedImage(“c:/image.png”)); mail.From = new MailAddress(“yourAddress@yourDomain”); mail.To.Add(“recipient@hisDomain”); mail.Subject = “yourSubject”; return mail; } private AlternateView GetEmbeddedImage(String filePath) { LinkedResource res = new LinkedResource(filePath); … Read more

How do I send an HTML email?

As per the Javadoc, the MimeMessage#setText() sets a default mime type of text/plain, while you need text/html. Rather use MimeMessage#setContent() instead. message.setContent(someHtmlMessage, “text/html; charset=utf-8”); For additional details, see: GMail Media Queries GMail CSS Design CSS support in mail clients

Should I use the Reply-To header when sending emails as a service to others?

I tested dkarp’s solution with gmail and it was filtered to spam. Use the Reply-To header instead (or in addition, although gmail apparently doesn’t need it). Here’s how linkedin does it: Sender: messages-noreply@bounce.linkedin.com From: John Doe via LinkedIn <member@linkedin.com> Reply-To: John Doe <John.Doe@gmail.com> To: My Name <My.Name@gmail.com> Once I switched to this format, gmail is … Read more

python: how to send mail with TO, CC and BCC?

Email headers don’t matter to the smtp server. Just add CC and BCC recipients to toaddrs when sending emails. For CC, add them to the CC header. toaddr=”buffy@sunnydale.k12.ca.us” cc = [‘alexander@sunydale.k12.ca.us’,’willow@sunnydale.k12.ca.us’] bcc = [‘chairman@slayerscouncil.uk’] fromaddr=”giles@sunnydale.k12.ca.us” message_subject = “disturbance in sector 7” message_text = “Three are dead in an attack in the sewers below sector 7.” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)