Sending emails with WAMP

This works for me and should work for you: Use Fake Sendmail and a webhost mail server (i.e. – Godaddy, 1and1, etc.). 1.) Download the sendmail zip and extract it to C:\Wamp\bin\sendmail (for purposes of this example). 2.) Edit C:\wamp\bin\sendmail\sendmail.ini and set the following to your mail server’s requirements (mine are below): smtp_server=mail.yourdomain.com smtp_port=26 smtp_ssl=none … Read more

mailto fails in IE where there is a long body text. Is there any way to resolve this?

I never could get the location.href = mailtoHref hack to work. However, I have found that following works. $(‘body’).append($(‘<iframe id=”mailtoHack” src=”‘ + mailtoHref + ‘”/>’); $(‘#mailtoHack’).remove(); EDIT Here is a way to do it without jQuery: function mailtoHack(href) { var iframeHack; if (href.indexOf(“mailto:”) === 0) { iframeHack = document.createElement(“IFRAME”); iframeHack.src = href; document.body.appendChild(iframeHack); document.body.removeChild(iframeHack); } … Read more

How to send email with pdf attachment in Python? [duplicate]

You create a message with an email package in this case – from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage msg = MIMEMultipart() msg.attach(MIMEText(open(“/home/myuser/sample.pdf”).read())) and then send the message. import smtplib mailer = smtplib.SMTP() mailer.connect() mailer.sendmail(from_, to, msg.as_string()) mailer.close() Several examples here – http://docs.python.org/library/email-examples.html UPDATE Updating the link since the above … Read more

Is the DataTypeAttribute validation working in MVC2?

[DataType(“EmailAddress”)] doesn’t influence validation by default. This is IsValid method of this attribute (from reflector): public override bool IsValid(object value) { return true; } This is example of custom DataTypeAttribute to validate Emails (taken from this site http://davidhayden.com/blog/dave/archive/2009/08/12/CustomDataTypeAttributeValidationCustomDisplay.aspx): [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] public class EmailAddressAttribute : DataTypeAttribute { private readonly Regex regex = … Read more

Failing to send email with the Python example

The following code works for me: import smtplib FROMADDR = “[email protected]” LOGIN = FROMADDR PASSWORD = “my.real.password” TOADDRS = [“[email protected]”] SUBJECT = “Test” msg = (“From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n” % (FROMADDR, “, “.join(TOADDRS), SUBJECT) ) msg += “some text\r\n” server = smtplib.SMTP(‘smtp.gmail.com’, 587) server.set_debuglevel(1) server.ehlo() server.starttls() server.login(LOGIN, PASSWORD) server.sendmail(FROMADDR, TOADDRS, msg) server.quit() I’m using Python … Read more

Sending Email through Outlook 2010 via C#

replace the line Outlook.MailItem mailItem = (Outlook.MailItem) this.Application.CreateItem(Outlook.OlItemType.olMailItem); with Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); Hope this helps,