Pound signs changing to hashes over email - email

The following is in a file all on its own:
<%
Dim mailtest
Set mailtest = CreateObject("CDO.Message")
mailtest.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
mailtest.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="localhost"
mailtest.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
mailtest.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=0
mailtest.Configuration.Fields.Update
mailtest.Subject = "Test email"
mailtest.From = "test#test.com"
mailtest.To = "test#test.com"
mailtest.HTMLBody = "£££"
mailtest.Send
%>
I'm using smtp4dev to receive the emails. When I open the email, the body is simply "###".
What on earth could be causing this? I could understand if they were changing to question marks or something due to encoding issues, but why might they be changing to hashes?

Related

Sending email with Classic ASP through Godaddy

I'm trying to send email using Classic ASP from my website at Godaddy. Unfortunately, the cod I have from 10-15 years ago doesn't work (imagine that! lol). Here's the code. Can someone tell me what has changed since then? desperately await your reply. Thank you!
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = false
.Item(cdoSendUserName) = "email#mywebsite.com"
.Item(cdoSendPassword) = "MyPassword"
.Item(cdoURLProxyServer) = "server:25"
'.Item(cdoSendUsingMethod) = cdoSendUsingPickup
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "relay-hosting.secureserver.net"
.Item(cdoURLGetLatestVersion) = True
.Update
End With
'Create mail object
Set cdoMessage = CreateObject("CDO.Message")
'Apply the settings to the message object then send the email
With cdoMessage
Set .Configuration = cdoConfig
.From = "Support (email#mywebsite)"
.To = "The User (user#email.com)"
.BCC = ""
.Subject = "This is a test email."
.TextBody = "This is a test email. If it were a real email there would be some blah blah blah here! This concludes the test of the Godaddy email message."
.Send
End With
'Cleanup mail objects
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Ok folks. This is for the people that need a guiding hand from time to time. However, make sure you enter the right username and password. When hosting on Godaddy you could have up to three different usernames and passwords. You have your Godaddy account username and password (that's not it!), you have a username and password for Plesk (that's not it either!). Then you have a username and password for your primary website (that's the one you want!). Even though you might have several different websites under your hosting, only one will be the primary. Mine was for the email and password that are associated with that prime website. Once you get this code posted you should be good to go. However, you might have to wait a while in order for it to start working. For me it took about 8 hours for the DNS to catch hold of what I was doing and start sending my emails through. Once it did though, now it works great! Enjoy!
Dim objNewMail
'Your email information
Set objNewMail = Server.CreateObject("CDO.Message")
objNewMail.From = "your-email#this-website.com"
objNewMail.Cc = "your-email#this-website.com"
objNewMail.To = "send-to#their-email.com"
objNewMail.Subject = "This is a test email"
objNewMail.TextBody = "this is a test email"
' GoDaddy SMTP Settings
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="relay-hosting.secureserver.net"
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/cdoSendUserName") = "your-primary-website-username"
objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/cdoSendPassword") = "your-primary-website-password"
objNewMail.Configuration.Fields.Update
objNewMail.Send
'After the Send method, NewMail Object become Invalid
Set objNewMail = Nothing

How to control tracking options and tags when using Mailgun's SMTP option (i.e. not using their API)

I’m using python to send emails using Mailgun’s SMTP server. I wish to use Mailgun’s builtin ability to tag my messages, and to track open and click events.
I know this can be done using Mailgun’s send message API, by adding headers like o:tag, o:tracking, o:tracking-clicks and o:tracking-opens (as explained here: https://documentation.mailgun.com/en/latest/api-sending.html#sending)
However, seeing as I'm the SMTP gateway and not the API, I’m trying to understand how to achieve the same result - emails that are tagged and fully tracked in Mailgun.
Any thoughts on how it can be done?
This is my little script at the moment:
message = MIMEMultipart("alternative")
message["Subject"] = "This is an email"
message["From"] = “<from email>”
message["To"] = “<to email>”
htmlpart = MIMEText("<html><body>email here!</body></html>", "html")
message.attach(htmlpart)
server = smtplib.SMTP_SSL(“<smtp server>”, 465)
server.ehlo()
server.login(“<username>”, “<password>”)
server.sendmail(from_addr=“<from email>”, to_addrs=“<to email>”, msg=message.as_string())
server.close()
Found it!
The following X-Mailgun headers can be added:
https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-smtp
So my script would be:
message = MIMEMultipart("alternative")
message["Subject"] = "This is an email"
message["From"] = “<from email>”
message["To"] = “<to email>”
message["X-Mailgun-Tag"] = "<tag>"
message["X-Mailgun-Track"] = "yes"
message["X-Mailgun-Track-Clicks"] = "yes"
message["X-Mailgun-Track-Opens"] = "yes"
htmlpart = MIMEText("<html><body>email here!</body></html>", "html")
message.attach(htmlpart)
server = smtplib.SMTP_SSL(“<smtp server>”, 465)
server.ehlo()
server.login(“<username>”, “<password>”)
server.sendmail(from_addr=“<from email>”, to_addrs=“<to email>”, msg=message.as_string())
server.close()
Now my email is tagged (can be analysed on a tag level in Mailgun), and clicks are tracked.
Happy days!

Flask HTML emails is not rendered

I have a flask application, where I want to send an email, along with some data fetched from a form. Everything works fine, but the issue is, that when the email is received the HTML code is not rendered it is only displayed the raw code. Here is what I have done so far
if google_response['success']: #this line is used for a ReCaptcha response
msg = Message('Thank you for contacting me', sender='(my email address is put here as a string)', recipients=[request.form['email']])
name = request.form['name']
msg.body = render_template('email.html', name=name)
mail.send(msg)
return render_template('index.html')
else:
return render_template('index.html')
What, am I doing wrong?
I am assuming this has to do with how you are creating your email. You should be using a Multipart Email to do so. My guess would be that you're using using your HTML as the text for the email and not actually attaching it to the email.
Since you haven't provided us with any of that code, I'll give you an example of how to generate an email that includes HTML formatting.
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
to_address = ''
from_address = ''
msg = MIMEMultipart('alternative')
msg['Subject'] = ''
msg['From'] = from_address
msg['To'] = to_address
text = ''
html = 'your HTML code goes here'
part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')
msg.attach(part1)
msg.attach(part2)
mail = smtplib.SMTP('smtp.gmail.com', 587)
mail.ehlo()
mail.starttls()
mail.login('', '')
mail.sendmail(to_address, from_address, msg.as_string())
mail.quit()

Using CDO to send using HTML Body in IIS7.5 and classic ASP

We are using the following script. It works fine if we call HTML/ASP from another URL but if we attempt to send mail from the domain the script is on the site times out and requires the application pool to be recycled.
The script also works if plain text is used and not HTML.
Any ideas folks?
<%#LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim objCDO
Set objCDO = Server.CreateObject ("CDO.Message")
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDO.Configuration.Fields.Update
objCDO.Subject = "XYZ Order"
objCDO.From = "all#xyz.co.uk"
objCDO.To = "user#user.com"
'objCDO.TextBody = "TEST E-MAIL"
objCDO.CreateMHTMLBody "http://www.xyz.co.uk/zzzHTML.asp"
objCDO.Send
Set objCDO = Nothing
%>

How to force text/html mime type using PeopleSoft SendMail()

I am trying to send an html formatted email using SendMail() in PeopleCode. What I am trying to do is very a basic html email (e.g. bolded text, a href tags, etc).
We recently upgraded to PeopleTools 8.52
When I use the default SendMail() example from PeopleBooks, The email is sent as plain text, regardless of the fact that I specified the content type as "text/html".
Local string &MAIL_CC, &MAIL_TO, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TITLES, &MAIL_TEXT, &MAIL_FILES, &MAIL_FROM, &REPLYTO, &SENDER;
Local number &MAIL_FLAGS;
&MAIL_FLAGS = 0;
&MAIL_TO = "laurie_thomas#peoplesoft.com";
&MAIL_CC = "";
&MAIL_BCC = "";
&MAIL_SUBJECT = "Testing SendMail - Are you receiving Attachment?";
&MAIL_TEXT = "This is a test for SendMail function";
&MAIL_FILES = "/data9/ps/e841g2bp/lat/attach.txt";
&MAIL_TITLES = "";
&MAIL_FROM = "peoplesoft#peoplesoft.com";
&MAIL_SEP = ";";
&CONTTYPE = "Content-type: text/html; charset=utf8";
&REPLYTO = "lthomas#peoplesoft.com";
&SENDER = "00972#peoplesoft.com";
&RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &CONTTYPE, &REPLYTO,&SENDER);
If &RET <> 0 Then
MessageBox(0, "", 0, 0, "Return code from SendMail=" | &RET);
End-If;
As it turns out, this is a documented bug observed by Oracle (Bug:13714374). This occurs when upgrading from PeopleTools 8.51 to 8.52 (which is why it happened to us).
Solution from Oracle:
This Bug Fixed in the PT 8.52.08 patch, which became available on
05/24/2012