I send mail from vmime using the following code:
vmime::string urlString;
urlString="smtp://outgoing.verizon.net";
vmime::utility::url url(urlString);
vmime::ref <vmime::net::transport> tr =
g_session->getTransport(url,vmime::create <interactiveAuthenticator>());
// You can also set some properties (see example7 to know the properties
// available for each service). For example, for SMTP:
tr->setProperty("options.need-authentication", true);
tr->setProperty("auth.username", userName);
tr->setProperty("auth.password", password);
fromString=userName+"#verizon.net";
vmime::mailbox from(fromString);
vmime::mailboxList to;
toString = toUserName+"#verizon.net";
to.appendMailbox(vmime::create <vmime::mailbox>(toString));
std::ostringstream data;
data<<subjectId;
// Connect to server
tr->connect();
// Send the message
vmime::string msgData = data.str();
vmime::utility::inputStreamStringAdapter vis(msgData);
tr->send(from, to, vis, msgData.length());
logMsg(DEBUG,2,"Thread Id: %ld,Sent the data in the transaction",pthread_self());
I see that the sent data is succesful from the log.
But when i connect to the box[to which the mail was sent] and check the inbox, i see 0 mails to that inbox.
There is no excepton or error from vmime.
when i connect to the web version of the mail box.Iam unable to see any transactions is sent box, even for the succesful mails.Can anyone help how i can see the mails sent in the sent box?
Thanks in advance.
use any sniffer to catch SMTP traffic from your host. if everything looks good (i.e. SMTP session correct), then it's not a problem of your host, but remote MTA (make sure your email wasn't detected as SPAM & etc)
Related
I'm getting bounce when I send an email to a specific address using SES, from gmail the mail is delivered correctly
For Transient -> General AWS says The recipient's email provider sent a general bounce message. You might be able to send a message to the same recipient in the future if the issue that caused the message to bounce is resolved.
How can I fix the issue if I do not know the problem?
"eventType":"Bounce",
"bounce":{
"bounceType":"Transient",
"bounceSubType":"General",
"bouncedRecipients":[
{
"emailAddress":"{some_email}",
"action":"failed",
"status":"5.7.8",
"diagnosticCode":"smtp; 535 5.7.8 Error: blocked by Block Address check from 54.240.8.90"
}
],
"timestamp":"2019-07-03T19:48:56.445Z",
"feedbackId":"0100016bb962013a-6cd68815-3c51-4216-9946-50f01b923057-000000",
"reportingMTA":"dsn; a8-90.smtp-out.amazonses.com"
}
Not much you can do, seems like the recipient side is checking IP reputation and found that SES IP (sending IP) 54.240.8.90 is in the blacklist, it also sent you a bounce back with custom message "smtp; 535 5.7.8 Error: blocked by Block Address check from 54.240.8.90".
Seems like they're using SORBS SPAM .
https://mxtoolbox.com/SuperTool.aspx?action=blacklist%3a54.240.8.90&run=toolpage
http://www.sorbs.net/cgi-bin/db
Couple of things you can try:
Remove the IP from SORBS by yourself (it may get added again)
Contact AWS to contact them to remove it from Blacklist.
Try dedicated IP pool.
Im trying to send an email in C++. I found the class CSmtp which looks like a fine one.So I tried out the example project but it gives the ErrorCode :
Error: Undefined error id.
Now I tried to find out where the problem is because the errorcode is too general.I Debuged the project find this Errorcode
ErrorCode WSA_SELECT (109) ECSmtp::CSmtpError
I googled after it but found no answer.Someone can help ?
Link for class : CSmtp with SSL/TLS
Code:
#include "CSmtp.h"
#include <iostream>
int main()
{
bool bError = false;
try
{
CSmtp mail;
#define test_gmail_tls
#if defined(test_gmail_tls)
mail.SetSMTPServer("smtp.gmail.com",587);
mail.SetSecurityType(USE_TLS);
#elif defined(test_gmail_ssl)
mail.SetSMTPServer("smtp.gmail.com",465);
mail.SetSecurityType(USE_SSL);
#elif defined(test_hotmail_TLS)
mail.SetSMTPServer("smtp.live.com",25);
mail.SetSecurityType(USE_TLS);
#elif defined(test_aol_tls)
mail.SetSMTPServer("smtp.aol.com",587);
mail.SetSecurityType(USE_TLS);
#elif defined(test_yahoo_ssl)
mail.SetSMTPServer("plus.smtp.mail.yahoo.com",465);
mail.SetSecurityType(USE_SSL);
#endif
mail.SetLogin("* My Email Adress *");
mail.SetPassword("*Password*");
mail.SetSenderName("User");
mail.SetSenderMail("* My Email Adress *");
mail.SetReplyTo("* Email Adress of my friend *");
mail.SetSubject("The message");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.AddMsgLine("Hello,");
mail.AddMsgLine("");
mail.AddMsgLine("...");
mail.AddMsgLine("How are you today?");
mail.AddMsgLine("");
mail.AddMsgLine("Regards");
mail.ModMsgLine(5,"regards");
mail.DelMsgLine(2);
mail.AddMsgLine("User");
//mail.AddAttachment("../test1.jpg");
//mail.AddAttachment("c:\\test2.exe");
//mail.AddAttachment("c:\\test3.txt");
mail.Send();
}
catch(ECSmtp e)
{
std::cout << "Error: " << e.GetErrorText().c_str() << ".\n";
bError = true;
}
if(!bError)
std::cout << "Mail was send successfully.\n";
return 0;
}
I would suggest you to go with powershell script for sending email and then call that script from your c++ program. Use smtp.gmail.com as server & 465 port. :)
This can help..
https://github.com/udit043/Send-email-using-powershell
Standard C++11 does not have such facilities (but your particular OS might provide additional SMTP client libraries). Maybe you want a library like vmime or a framework like POCO
Notice that the very ability of email is operating system specific.
Also, most SMTP servers are configured to reject open mail relaying (otherwise, they would be used by spam bots, and emails going thru them would be rejected since blacklisted).
You could for example configure some SMTP service on your local machine or server, and programmatically send email thru localhost (then the SMTP server would spool and relay the email, etc.) - or to some specific and well-defined "smarthost" if your system and network has one; you probably don't want to wire-in some SMTP relay host names in your program, and you do want the email to be spooled (not lost!) if the recipient SMTP server is down or unreachable; in other words, you need some SMTP server.
You certainly don't want to code your SMTP server from scratch!
Hence, your program should only send SMTP to some trusted host, which is correctly configured to avoid spamming (then you might need to set some From or Reply-To SMTP header to something appropriate for your SMTP host). Be sure that major Internet companies like Google, Yahoo, AOL etc... are configuring carefully their SMTP service to disallow open relay spamming. Often, they accept SMTP relay connections only from their business clients (and they would cut a client doing automated spamming). So you should send SMTP to your ISP's SMTP server (or to some local or near SMTP server).
Notice that spamming is usually forbidden by law or by your ISP terms of service.
You could also run some command (e.g. using popen) to send mail ...
For some reason I can not get ActiveMQ to deliver compressed messages.
The messages are definitely uncompressed. I confirmed this with a sniffer.
"setUseCompression" is definitely "true". I read this back and log it.
The client is 5.9. The server is 5.6 (Is this maybe the problem?)
The URI is of the form tcp://xxx.xxx.xxx.xxx:61000
Code snippet:
connectionFactory = new ActiveMQConnectionFactory(usr, pwd, uri);
connectionFactory.setOptimizeAcknowledge(true);
connectionFactory.setOptimizeAcknowledgeTimeOut(1000);
connectionFactory.setUseCompression(compressionEnabled);
connectionFactory.setClientID(queueClientID);
connection = connectionFactory.createConnection();
connection.start();
if (!connectionFactory.isUseCompression())
logger.warn("Compression is not enabled for activeMQ session");
else
logger.info("Compression is enabled for activeMQ session");
Ideas anyone?
Tx
Iam trying to send a message to activemq using pythons stompclient.
https://bitbucket.org/hozn/stompclient/wiki/User%20Documentation
If there is a better library for this Im open to suggestions.
If i change to ip or port it will fail to connect so im assuming that the connection is working. There are no errors when I run this code its just that I see no messages on the queue. I think the destination path is possibly where it is failing the PhysicalName of the activemq queue is in this pattern 'abc.queue_name'.
I've tried the following destinations
/queue/abc/queue_name
/queue/abc.queue_name
abc.queue_name
Any suggestions are greatly appreciated.
Thanks
from stompclient import PublishClient
client = PublishClient('IP', 53680)
response = client.connect('defaultPassword', 'defaultUser')
reponse1 = client.send('/queue/abc/queue_name', 'bla')
time.sleep(5)
Have you checked the webconsole to see if your Queue was created by the send?
You should also try adding a request id onto the send and waiting for a response, this will ensure that the broker has enough time to get the sent data before you client code disconnects.
You might also want to check the Broker logs to see if any errors are logged or any security warnings in case the user doesn't have publish rights.
Added this property to the activemq.xml file and im now seeing messages on the queue via the web console.
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
I'm trying to make an IRC Bot that will log in to an existing account (on QuakeNet), so the Q bot can grant him the operator rank. I can successfully log in to server with a proper nick, but I don't know how to make my bot actually log in to an account. Here is the code I use:
send(cSock, "PASS SuperPasswordOfAnAdmin\r\n", strlen("PASS SuperPasswordOfAnAdmin\r\n"), NULL);
send(cSock, "USER custom 0 0 SuperUsernameOfAnAdmin\r\n", strlen("USER custom 0 0 SuperUsernameOfAnAdmin\r\n"), NULL);
send(cSock, "NICK SuperNickOfAnAdmin\r\n", strlen("NICK SuperNickOfAnAdmin\r\n"), NULL);
And it doesn't seems to work properly. Does anybody know what should I do?
Thanks in advance for any replies.
I would suggest using a client like XChat and manually performing the steps that you're trying to have the bot automate and watching the raw log window. This will show you the commands that are being executed by your client, and anything the server is sending that you'll need to wait on or respond to.
Note that when you're looking at the commands in the QuakeNet documentation, these are client commands, not the actual IRC commands that are sent to the server. For instance, /msg user message here is actually sent over the wire as PRIVMSG user :message here.
I suspect you will have to do somewhat more than what your initial code suggests in order to properly satisfy the IRC server, like handling PING/PONG and waiting for the 001 numeric. In pseudocode:
// connect
conn := Connect("tcp", "your.irc.server:6667")
// login
Fprintf(conn, "PASS %s\r\n", server_password)
Fprintf(conn, "USER %s . . :%s\r\n", username, realname)
Fprintf(conn, "NICK %s\r\n", nick)
forever {
line := ReadLine(conn)
command, args := ParseIRCLine(line)
// welcome message, we're in!
if command == "001" {
break
}
// PING, send PONG
if command == "PING" {
Fprintf(conn, "PONG :%s\r\n", Join(args, " "))
}
}
Fprintf("PRIVMSG Q#CServe.quakenet.org :AUTH %s %s\r\n", username, password)
// wait for response from Q
// join channels, etc
// handle more pings, channel messages, etc
Usually IRC servers have a service called NICKSERV which allows you to identify your account:
You specify the following command:
/nickserv identify [nickname] password
So in your C++ program you would have to send:
send(cSock, "NICKSERV IDENTIFY SuperNickofAnAdmin SuperPasswordOfAnAdmin");
For QBOT you can do:
/msg Q#CServe.quakenet.org AUTH username password
So in your C++ program you send:
send(cSock, "MSG Q#CServe.quakenet.org AUTH SuperNickofAnAdmin SuperPasswordOfAnAdmin");
To grant the user operator status on IRC you will have to send the command:
MODE #Channel +o username
+o is the operator status and will display the '#' before the user's alias.
You can use a telnet client to speak directly with the server. This will require you to use all of the behind-the-scenes commands, which may help familiarize you with the required I/O needed for a running bot.
Source is the top rated answer on this question: How do i program a simple IRC bot in python?