I need to send a link within HTML email using CodeIgniter.
first trial:-
send an email to using Gmail server, then the link will be sent successfully without any corruption.
Second trial:
I am using Microsoft Exchange Server.
when sending the link within the HTML email, the link will be received corruptly!!
I don't know why? Then the problem occurred when using only Exchange server.
correct link
http://000.00.0.00/s/admin/r?i=7&e=hana#dom.edu.com
corrupted link
http://000.00.0.00/s/admin/r?i=7&e=hana#do=.edu.com
If I put it within a href tag
correct link
http://000.00.0.00/s/admin/r?i=7&e=2
corrected link
http://000.00.0.00/s/admin/r=i=7&e=2
My IP= 000.00.0.00, it is not the actual but it is just an example
You have to change the crlf setting to use Exchange as an SMTP server.
Add $this->email->set_crlf( "\r\n" );to your controller or add $config['crlf'] = "\r\n"; to your email config file!
The equal signs getting substituted into your email message are a dead giveaway that the end of line character is the issue.
Related
When I send an email using phpmailer to gmail, and I look the email source, I see the following next to the "from" field:
"Using PHPMailer 6.1.7 (https://github.com/PHPMailer/PHPMailer)"
For security reasons I'd prefer to remove that if it's possible, but I don't know if this is Gmail being smart or phpmailer appending it to every email message I send.
How can I remove it?
Thanks
This appears in the X-Mailer header. As per the docs, you can remove this header altogether by setting it to a space, like this:
$mail->XMailer = ' ';
If it's appearing somewhere else, I'll need to see the rest of your code and the headers of a message you've received in gmail.
I am sending email using php mailer and email is going fine to the inbox
but next time when i reply back instead of email coming to under same conversation it create a new email even it should show all the email subject
any one has an idea ?
The email you send via php must have a header
Reply-To: <from-email-address>
From: <from-email-address>
as well as a
To: <destination-email-address>
header line for it to appear as a conversation thread.
Also the subject line should be the same or be the same with a prepended 'Re: '
I got the Gmail Rest API sending part working but the e-mail doesn't include the signature and in recipient's inbox the 'from' label is sender's user id not the name of the user.
This is in php.
$mime = new Mail_mime();
$mime->setFrom("ABCD"); //This doesn't work....
$mime->setSubject('Testing');
$mime->setTXTBody('This is a demo mail');
$mime->addTo('a#a.com');
$message_body = $mime->getMessage();
$encodeMessage = base64url_encode($message_body);
$message = new Google_Service_Gmail_Message();
$message->setRaw($encodeMessage);
$send = $service->users_messages->send('me', $message);
Is there anyway to include the signature and change the 'from'?
The signature is not added by the API because it is a setting on the web client, not a global setting for the entire account. If you configure your Gmail account on Thunderbird, Outlook or another email client, Gmail will not add the signature either. You should think about Gmail in two separate ways:
The web client interface, accessible at https://mail.google.com, which is just an email client like any other;
Your inbox, the place where messages end up in, which is completely independent of the clients you use to access it.
In other words, this is an email client-dependent setting, and the only thing the clients do is add a bit of text to the text you write yourself, nothing else.
I know this is old but you can retrieve via API the users signature.
https://developers.google.com/admin-sdk/email-settings/#manage_signature_settings
you can then append to your email that you are composing.
I'm looking for a way to capture and manage email data using PHP. Basically, what I want to do is capture all the data in an email and then manipulate this data to my specification.
For example, say, I send an email containing a .zip file attachment to myemail#myproject.com, I want to be able to:
Get the attachment and place it in a specific folder on my site
Get the text content of the email
Get the subject of the email
Get the sender's info i.e. email address
Anyone know how I can get this done efficiently with PHP. I'm using LAMP by the way.
Thanks.
Start with PEAR Mail_mimeDecode. What you are looking to do is ambitious but can be done.
Basically what you will be doing is:
Instructing your MTA to deliver mail from an address to a pipe into your PHP script. Postfix and Sendmail can handle this with an alias like:
myemail: "|/path/to/your/parsingscript.php"
Parsing out the parts of the MIME email message
Locating and storing attachments after decoding them from base64 (or other encoding)
Parsing the headers.
Your PHP script will likely read the email message from STDIN and then pass the string to mimeDecode, which creates an object containing all the MIME parts.
Assuming your message was received into $str from STDIN, something like this gets you started:
$mime = Mail_mimeDecode::decode(array('include_bodies'=>TRUE, 'decode_headers'=>TRUE, 'decode_bodies'=>TRUE, 'input'=>$str));
// get the recipient To address:
$to = $mime->headers['to'];
I'm using SwiftMailer for PHP from swiftmailer.org
Everything works well but I wonder if there is a way to add the sent message into the sent folder from the mail account that SwiftMailer is sending from?
That's all, have a nice day.
According to the developer, swiftmailer cannot copy to Sent folder because it is a mail sender and not mailbox manager.
As mentioned on the github page:
Swiftmailer is a library to send emails, not to manage mailboxes. So, this is indeed out of the scope of Swiftmailer.
However, someone from php.net posted a solution that might work for you:
Use SwiftMailer to send the message via PHP.
$message = Swift_Message::newInstance("Subject goes here");
// (then add from, to, body, attachments etc)
$result = $mailer->send($message);
When you construct the message in step 1) above save it to a variable as follows:
$msg = $message->toString();
// (this creates the full MIME message required for imap_append()!!
// After this you can call imap_append like this:
imap_append($imap_conn,$mail_box,$msg."\r\n","\\Seen");
I've had similar problem and Sutandiono's answer got me into right direction. However because of completeness and as I had additional problem connecting to an Exchange 2007 server, I wanted to provide a complete snippet for storing message to Sent folder on IMAP:
$msg = $message->toString();
// $message is instance of Swift_Message from SwiftMailer
$stream = imap_open("{mail.XXXXX.org/imap/ssl/novalidate-cert}", "username", "password", null, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
// connect to IMAP SSL (port 993) without Kerberos and no certificate validation
imap_append($stream,"{mail.XXXXX.org/imap/ssl/novalidate-cert}Sent Items",$msg."\r\n","\\Seen");
// Saves message to Sent folder and marks it as read
imap_close($stream);
// Close connection to the server when you're done
Replace server hostname, username and password with your own information.