bool Emailer::openSendResultsEmail(CrosswordBase& puzzle) { QDir dir; QString emailAddress = getEmailAddress(dir.absolutePath().append(sc_AnswersEmailAddressFileLocation)); QString emailSubject = puzzle.getTitle().append(" answers"); QString emailBody; emailBody.append(puzzle.getInformation().append("%0A%0A")); //copy and sort by calendar date std::vector<CrosswordEntry> entries = puzzle.getEntries(); std::sort(entries.begin(), entries.end(), SortByIdentifier()); for(unsigned int i = 0; i < entries.size(); i++) { QString id = entries.at(i).getIdentifier(); QString entryName = entries.at(i).getEntry(); QString direction = entries.at(i).getDirection(); QString answer = entries.at(i).getGuess().getString(); emailBody.append(id).append(" - ").append(QUrl::toPercentEncoding(entryName)) .append(" ").append(QUrl::toPercentEncoding(direction)) .append(" --- ").append(QUrl::toPercentEncoding(answer)) .append("%0A"); } QUrl mailtoURL = QUrl(QString("mailto:").append(emailAddress) .append("?subject=").append(emailSubject) .append("&body=").append(emailBody)); if(QDesktopServices::openUrl(mailtoURL)) { return true; } else { return false; } }
char* osmsMessageCreateUserRequest::encode() { XMLDocument* pDoc = new XMLDocument(); if (pDoc == NULL) return NULL; if (!pDoc->decode(xmlTemplate(), getName())) { delete pDoc; return NULL; } pDoc->setInteger("MessageType", getMessageType()); pDoc->setString("UserName", getUserName()); pDoc->setString("Password", getPassword()); pDoc->setString("EmailAddress", getEmailAddress()); char *result = pDoc->encode(); delete pDoc; return result; }
bool Emailer::openFeedbackEmail() { QDir dir; QString emailAddress = getEmailAddress(dir.absolutePath().append(sc_FeedbackEmailAddressFileLocation)); QString emailSubject = Version::getApplicationVersionDescription().append(" feedback message"); QString emailBody; emailBody.append(QString("This feedback email was sent from ").append(Version::getApplicationVersionDescription())); QUrl mailtoURL = QUrl(QString("mailto:").append(emailAddress) .append("?subject=").append(emailSubject) .append("&body=").append(emailBody)); if(QDesktopServices::openUrl(mailtoURL)) { return true; } else { return false; } }
//----------------------------------------------------------------------------- QString KPIM::getEmailAddress( const QString & address ) { return QString::fromUtf8( getEmailAddress( address.utf8() ) ); }