I have to move some customer website from one (old) server to another (newer one). All sites are programmed in ASP. One customer sends Email (for his webshop) to his users using the persits framework, like
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.domain.com"
Mail.CharSet = "ISO..."
Mail.Username = "Admin#domain.com"
Mail.Password = "password"
Mail.From = shopmail
Mail.FromName = "Name"
Mail.AddAddress shopmail
Mail.Subject = "Order " & date
Mail.Body = msgBody
Mail.Send
This framework isn't installed on the new server and also there are no SMTP services installed.
How could I get it done that mails could be sent without the features mentioned above? Is there a way to reach a external STMP server with ASP?
Thanks in advance.
Best regards.
I'v found a solution, it's well documented here (for everyone who's interested in :) ).
Related
I just need to be pointed in the right direction, on how
to send an email using VBA. I have Lotus as an email system which is embedded into our intranet system.
As a try, this code prepares an email and send it via Lotus (installed on pc) :
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim sender, recipient As String
'sender = Forms![LogIn]![TxtEmail]
If (Not IsNull(DLookup("Email", "Users", "UserName ='" & Me.Affectation.Value & "'"))) Then
recipient = DLookup("Email", "Users", "UserName ='" & Me.Affectation.Value & "'")
MsgBox "recipient *" & recipient & "*"
Else
MsgBox " recipient null"
End If
If Not (ns Is Nothing) Then
Call ns.InitializeUsingNotesUserName("CN=MyuserName/O=Cmpany", "password")
Set db = ns.GetDatabase("ServerName", "mail\MyuserName.nsf", False)
If (Not (db Is Nothing)) Then
Set doc = db.CreateDocument()
doc.Form = "Memo"
doc.SendTo = recipient
doc.subject = "Email Subject"
Dim rt As NotesRichTextItem
Set rt = doc.CreateRichTextItem("Body")
rt.AppendText ("Body text")
doc.Send (False)
Set rt = Nothing
Set doc = Nothing
MsgBox "Message Sent."
Else
MsgBox "db Is Nothing"
End If
Set db = Nothing
Set ns = Nothing
Else
MsgBox "ns Is Nothing"
End If
My question here is how set this code to make the target Lotus the one on our intranet: my login is such "39398C#mycompany.com" and the application is accessed by "http://mail.mycompany.com/mail/username.nsf..."
Unfortunately this is not possible this way. This "embedded" Lotus Notes as you call it is a simple website. It is called "iNotes" and does not have any dlls installed on your client (unless you install the ActiveX control for IE, but that does not help anything with your problem).
For sending eMails via iNotes you need a complete new method and you need your Domino administrator to help you with it: You could either use a webservice to send your mail (this has to be enabled on the server) or you can use DIIOP (again: DIIOP- Task has to be loaded on server).
To at least compose an email, you could use the mailto: protocol, but you need to set iNotes to be your mailto- protocol- handler:
Open Internet Explorer browser and log into iNotes (http://mail.mycompany.com/mail/username.nsf). Please note that this option is not available at this time to Firefox browser users.
Click the "Preferences" button located in the top right corner.
Find "Default Mail Client" section on the "Basics" tab of the iNotes preferences.
Click the button "Make Default".
Using this approach you cannot send the mail directly but need the user to press "Send".
I am not sure what you mean by "I have Lotus as an email system which is embedded into our intranet system".
You need the Notes client installed locally to be able to use COM in your own code. Use the ID file (must be local in the Notes Data directory) for your corporate account amd point to the server on the network for your mailfile.
But you can't point your program to a iNotes instance on a web server, it has to be on a Domino server accessed with a Notes client.
What you could do is to create a new web application on the server, where you have an agent that will read HTTP POST data, create an email and send it out.
Then you simply make a HTTP post from your application.
Here are a couple of blog entries I wrote that might help you:
http://blog.texasswede.com/free-code-class-to-read-url-name-value-pairs/
http://blog.texasswede.com/parse-url-in-domino-agent/
You should probably change your code to send mail via SMTP instead of using the Notes API objects. Microsoft provides an object model called CDO that I think will help you. See the answer to theis question for details. You will just need the hostname or IP address information to connect to a Domino server in your infrastructure that supports inbound SMTP.
Not sure about it, because that code is pretty old as we know use Outlook and I haven't use it in a long while, but that might be some insight :
I seem to remember that if you add doc.From = ns.CommonUserName, this will choose your session automatically!
And the full code :
Dim session As Object
Dim db As Object
Dim doc As Object
Dim attachme As Object
Dim EmbedObj As Object
Dim attachment() As String
Dim i As Integer
Set session = CreateObject("notes.notessession")
Set db = session.GetDatabase("", "")
Call db.OPENMAIL
Set doc = db.CreateDocument
With doc
.Form = "Memo"
.sendto = MailDestinataire
'.copyto = MailDestinataire2
.Subject = Sujet
.Body = CorpsMessage
.From = session.CommonUserName
.posteddate = Now
.SaveMessageOnSend = True
End With
Ok, in these times when some people move from Lotus Notes to Office 365 I have come across a certain requirement...
An older workflow application sends mail to users. This has worked fine for ages. But now we have a new type of users. These users are just using Notes for a couple of old legacy applications like the one in question.
The error we get is:
File does not exist
And the code that generates it is pretty simple:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rtitem As NotesRichtextItem
Dim doc2 As NotesDocument
Set db = session.CurrentDatabase
Set doc2 = New NotesDocument(db)
doc2.Form = "Memo"
doc2.Subject = "Test mail " & now
Set rtitem = New NotesRichTextItem (doc2, "Body" )
Call rtitem.AppendText("A simple test....")
Call rtitem.addnewline(2)
Call rtitem.AppendText("Link to complaint ")
Call doc2.Replaceitemvalue("sendto", "john#dalsgaard-data.dk")
doc2.Send( False )
It fails when running the last line....
So, the question really is: How can I code around the this issue?
I know there is no mail file for the user - and I would really prefer not to have to create one for the new users.
Thanks in advance!
/John
Error will appear when user triggering the code doesn't have a mail file specified in person document/location. One option would be to change code to save the new mail directly to server mail.box (assuming server is configured to route mails) or just send the email directly through SMTP using java.
Ok, I have done some trial & error testing on this....
Conclusion so far is that it works in this situation:
In the LOCAL location document (in names.nsf on the computer) you specify:
Mail server - as a server the user can reach
Mail "On Server"
An existing mail file - it can be ANY existing file on the server, it doesn't have to be a mail database.
Actually, a non-conclusive test indicates the mail database even doesn't have to exist (but the user with the setup for testing had to leave - so I couldn't confirm this tonight...)
Edit:
Further testing indicates that this may not be a problem if the user is NOT roaming. I need some further verification that this is actually the reason why I got it working (for one thing you cannot remove the mail file name again once added)... But thought I would add it here.
I'm new to IMAP.
I'm trying to fetch mails from outlook.com, I have configured outlook.com IMAP settings in my email client. I'm able to connect and get messages from outlook.com.
But when I'm trying to get messages by using search term like
I'm using Java mail packages.
IMAPStore store = getStore(serverName, userName, password, port);
IMAPFolder inboxFolder = (IMAPFolder) store.getFolder("INBOX");
SearchTerm[] searchTerms = new SearchTerm[4];
Address address = new InternetAddress("search_email_address");
SearchTerm toTerm = new RecipientTerm(Message.RecipientType.TO, address);
SearchTerm ccTerm = new RecipientTerm(Message.RecipientType.CC, address);
SearchTerm bccTerm = new RecipientTerm(Message.RecipientType.BCC, address);
SearchTerm fromStringTerm = new FromStringTerm(searchEmail);
searchTerms[0] = toTerm;
searchTerms[1] = ccTerm;
searchTerms[2] = bccTerm;
searchTerms[3] = fromStringTerm;
OrTerm orTerms = new OrTerm(searchTerms);
inboxFolder.search(orTerms);
I'm trying to search mails using like above search terms in a IMAP folder, but I'm getting zero mails.
Any API limitations in this or any problems in code, please guide me
Thanks
Ramesh
Looking at the question "Does IMAP search work on outlook.com" I can say: Yes.
I'm using imapsync to sync from outlook.com to other mailboxes and it works. Behind the scenes imapsync uses IMAP searches.
The IMAP capabilities announced by outlook.com are:
IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+ AUTH
Maybe this helps somebody. This could also explain why certain search keywords might or might not work.
I am using EWS Managed API to send email.
I am getting a Microsoft.Exchange.WebServices.Data.ServiceResponseException: EmailAddress or ItemId must be included in the request.
In the Soap return XML I see ErrorMissingInformationEmailAddress : This error occurs if the EmailAddress (NonEmptyStringType) element is missing.
Which email address is it talking about?
Using Exchange 2007 SP1.
Exchange credentials are correct and the to/from email addresses are valid emails.
Any ideas? Google has not helped.
Same code has worked for other Exchange Servers.
service.AutodiscoverUrl() does not work for this server.
using Microsoft.Exchange.WebServices.Data;
protected void SendEwsMail()
{
//Trust all certificates
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential("user#domain.com", "password");
service.Url = new Uri("Url");
var email = new EmailMessage(service);
email.ToRecipients.Add("user#domain.com");
email.From = new EmailAddress("user#domain.com");
//email.ReplyTo.Add(recipient.FromAddress);
email.Sender = new EmailAddress("user#domain.com");
email.Subject = "test";
// Send the message and save a copy.
email.SendAndSaveCopy();
}
It turns out that for the mail Server (MS Exchange) in question I needed to use this method:
Writing an encrypted mail via Exchange Web Services
var item = new EmailMessage(service);
item.MimeContent = new MimeContent(Encoding.ASCII.HeaderName, content);
// Set recipient infos, etc.
item.Send();
It seems to be because of the encrypyed MIME attachment. Using the standard To, From, Subject properties of the Microsoft.Exchange.WebServices.Data.EmailMessage class does not work correctly.
Although it does work as expected when the mail server was SmarterMail.
SmarterMail 9.x is one of the only mail servers (including Microsoft Exchange) to support Exchange Web Services (EWS).
(from http://blogs.smartertools.com/tag/exchange-web-services/)
Anyone know why SmarterMail would behave differently to MS Exchange?
I'm trying to send an email in a DNN module I'm making. However, though it doesn't crash the email isn't being sent. I think it has to do with the From Email I'm attempting to use. I'm not 100% sure what email I should be using for the from which is the first parameter.
Protected Sub Submit_Click(sender As Object, e As EventArgs) Handles Submit.Click
DotNetNuke.Services.Mail.Mail.SendEmail("support#localhost", "myemail#site.com", "EmailTest", "Hello world!")
End Sub
The More likely problem is you don't have your SMTP settings properly configured. To configure your SMTP settings, Login as Host. Then, go to Host -> Settings and fill out the fields under "SMTP Server Settings" and save them. There's a test link there as well to verify they are working correctly.
This is probably pretty late to the party, but I often use the Mail.SendMail() method, and then manually pass all the STMP information like below, and then when debugging I check the message that comes back. (As of DotNetNuke 5.5)
Dictionary<string, string> hostSettings = HostController.Instance.GetSettingsDictionary();
string server = hostSettings["SMTPServer"];
string authentication = hostSettings["SMTPAuthentication"];
string password = hostSettings["SMTPPassword"];
string username = hostSettings["SMTPUsername"];
// using the Mail.SendMail() method allows for easier debugging.
var message = Mail.SendMail(from, user.Email, String.Empty, subject, body, String.Empty, "HTML", server, authentication, username, password);
Late to the game as well, but I just ran into a similar issue earlier today...
The DNN sendMail or sendEmail method handle the exceptions on their own, and add it to their DNN logs. Unfortunately, they never return said exceptions to the main code where you are calling the functions - hence why your code executes just fine!
You can look further into their exceptions table, or Admin Logs in the UI, for more info on the particular issue you are having.
I changed my code to use System.Net to send emails and collect all of the info you need from DotNetNuke.Entities.Host.Host object in DNN. This way, we can handle the error and have our code work around it :) I ended up with something like this (it's in c# but you can do the same in VB.Net with a slightly different syntax):
//make the email
MailMessage mail = new MailMessage("From#me.com","to#a.com,to#b.com,to#c.com");
mail.Subject = "test subject";
mail.Body = "actual email";
string dnnServerInfo = DotNetNuke.Entities.Host.Host.SMTPServer;
// The above looks like "server.com:port#", or "smtp.server.com:25"
//so we find the colon to get the server name, and port using the index below
int index = dnnServerInfo.IndexOf(':');
//make the SMPT Client
SmtpClient smtp = new SmtpClient();
smtp.Host = dnnServerInfo.Substring(0, index);
smtp.Port = Int32.Parse(dnnServerInfo.Substring(index + 1, dnnServerInfo.Length - index - 1));
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential(DotNetNuke.Entities.Host.Host.SMTPUsername, DotNetNuke.Entities.Host.Host.SMTPPassword);
smtp.EnableSsl = DotNetNuke.Entities.Host.Host.EnableSMTPSSL;
//send the email
smtp.Send(mail);
I used part of the original code from "SendMail" found here to come up with this: https://stackoverflow.com/a/19515503/6659531
Good luck to anybody who comes across this :)